-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not find a valid Docker environment on MBP M1 (Apple Silicon) #162
Comments
Hi @landsman, thanks for the report. I found the following issue testcontainers/testcontainers-java#3834 in the Testcontainers project that we use to integrate with Docker. Could you please take a look at it and let me know if it helped you? |
@tomix26 Thank you for the link. I add this mentioned dependency but it had no effect on this error. |
@landsman I was facing the same issue and adding the |
I have the same issue, when I run the test in IntelliJ it works and when I start SpringBoot Application in IntelliJ it works too but when I run my Docker it fails, I added jna dependency but it didn't fix the issue Here is the stacktrace: Did I miss something in the configurations? Do I need to update my Docker file? BTW, I use multistage docker, so I run mvn build inside my container. |
@ahezzati I guess your problem is caused by running the build in a docker container in conjunction with using the docker provider. In that case you are actually starting a docker container in another docker container, which is possible but it requires additional configuration. See the instructions here: https://github.com/zonkyio/embedded-database-spring-test#using-docker-provider-inside-a-docker-container Or the other option is to use a different provider, such as the zonky provider: https://github.com/zonkyio/embedded-database-spring-test#using-zonky-provider-previous-default |
Thanks @tomix26 for the response and the links. I believe it won't work for my case because we user multistage docker where we run mvn install during Docker build image and default provider that uses TestContainers expect running container which is not possible during build stage, and even when I tried (Zonky and OpenTable) both failed with the same erro |
Yes, you're right. It seems that running a docker container during docker build is not supported right now. However, the other provides should work. So could you please provide a logfile with more details for further investigation? |
My bad, actually I was wrong, when I changed to Zonky provider I needed to run as non-root user as mentioned in the documentation, once I did it fixed the issue and integration test is working fine now My Dockerfile before
My Dockerfile after
That's good news for mutlistage Docker and Docker in Docker, thanks @tomix26 for your help and response |
This is working! Thank you! |
I will consider it, thanks for the feedback. |
Seems that I still have this issue. The thread linked above says to upgrade testcontainers to 1.16 and to use the jna dependency. I'd recommend this project bump the testcontainers version soon and add the jna as well for compatibility. Ref: testcontainers/testcontainers-java#3834 (comment) I'm using docker-cli with the colima runtime, and it has this same build error. |
Hello,
we are using this integration and it's amazing! Thank you for it.
We are slowly migrating from Linux to MBP M1 (Apple Silicon), and facing a problem with Docker settings. I would like to ask you for advice, what can I change. Do you have some experience with this?
Env:
a) Docker installed from the link: https://docs.docker.com/docker-for-mac/apple-silicon/
b) docker working in the terminal
c) dependencies:
d) firewall is turn off, no vpn etc
Exception after I try to run tests:
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is io.zonky.test.db.shaded.com.google.common.util.concurrent.UncheckedExecutionException: io.zonky.test.db.provider.ProviderException: Unexpected error when preparing a database cluster; nested exception is java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
The text was updated successfully, but these errors were encountered: