You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a new MacBook with the M1 chip, I get an error when trying to start a container:
no suitable image found. Did find:
/some/random/tmp/file: no matching architecture in universal wrapper
I get a similar error running the container manually with docker run <image-name>, but it will work if I use docker run --platform linux/amd64 <image-name>. Is it possible to use that parameter with testcontainters?
Reacted by Dmytro Pishchukhin, Antonio Soto, Fraser Kettle, Dmitry Adonin, Nikolai Rubtsov, Seb Smith, Jared Rhizor, David Bush, Satoshi Yamamoto, Timur and 21 more
I have the same problem with a MacBook Pro Silicon M1 chip. I want to run a PostgreSQL container that has an ARM version indeed:
I can perfectly run by terminal:
However, I got an exception when I run the test in IntelliJ or by commands (I remark this to dismiss the idea that can be an IDE problem). I test this code on my old PC with an x86-64 processor and it runs fine, the code is:
09:54:24.292 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.294 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
09:54:24.298 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
09:54:24.310 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
09:54:24.320 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: class path resource [de/rieckpil/blog/SpringBootHibernateFlywayBestPracticesApplicationTests-context.xml] does not exist
09:54:24.320 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: class path resource [de/rieckpil/blog/SpringBootHibernateFlywayBestPracticesApplicationTestsContext.groovy] does not exist
09:54:24.320 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
09:54:24.321 [main] DEBUG org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Ignoring class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests$Initializer]; it must be static, non-private, non-final, and annotated with @Configuration to be considered a default configuration class.
09:54:24.321 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: SpringBootHibernateFlywayBestPracticesApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
09:54:24.336 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.372 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [/Users/antonio/Downloads/blog-tutorials-master/spring-boot-hibernate-flyway-best-practices/target/classes/de/rieckpil/blog/SpringBootHibernateFlywayBestPracticesApplication.class]
09:54:24.373 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplication for test class de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests
09:54:24.412 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: using defaults.
09:54:24.412 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
09:54:24.418 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@93cf163, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@1852a3ff, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@7203c7ff, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@25bfcafd, org.springframework.test.context.support.DirtiesContextTestExecutionListener@4b6690c0, org.springframework.test.context.transaction.TransactionalTestExecutionListener@46268f08, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@2a76840c, org.springframework.test.context.event.EventPublishingTestExecutionListener@71454b9d, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@eda25e5, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@7cf6a5f9, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@623e088f, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@39fcbef6, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@66565121, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@2fc6f97f]
09:54:24.419 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.420 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.420 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.421 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.422 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.422 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.431 [main] DEBUG org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.431 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating CacheAwareContextLoaderDelegate from class [org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate]
09:54:24.431 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating BootstrapContext using constructor [public org.springframework.test.context.support.DefaultBootstrapContext(java.lang.Class,org.springframework.test.context.CacheAwareContextLoaderDelegate)]
09:54:24.432 [main] DEBUG org.springframework.test.context.BootstrapUtils - Instantiating TestContextBootstrapper for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests] from class [org.springframework.boot.test.context.SpringBootTestContextBootstrapper]
09:54:24.432 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: class path resource [de/rieckpil/blog/SpringBootHibernateFlywayBestPracticesApplicationTests-context.xml] does not exist
09:54:24.433 [main] DEBUG org.springframework.test.context.support.AbstractContextLoader - Did not detect default resource location for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: class path resource [de/rieckpil/blog/SpringBootHibernateFlywayBestPracticesApplicationTestsContext.groovy] does not exist
09:54:24.433 [main] INFO org.springframework.test.context.support.AbstractContextLoader - Could not detect default resource locations for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: no resource found for suffixes {-context.xml, Context.groovy}.
09:54:24.433 [main] DEBUG org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Ignoring class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests$Initializer]; it must be static, non-private, non-final, and annotated with @Configuration to be considered a default configuration class.
09:54:24.433 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: SpringBootHibernateFlywayBestPracticesApplicationTests does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
09:54:24.434 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.434 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplication for test class de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests
09:54:24.435 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]: using defaults.
09:54:24.435 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
09:54:24.436 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@2c532cd8, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@294e5088, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@51972dc7, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@3700ec9c, org.springframework.test.context.support.DirtiesContextTestExecutionListener@2002348, org.springframework.test.context.transaction.TransactionalTestExecutionListener@5911e990, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@31000e60, org.springframework.test.context.event.EventPublishingTestExecutionListener@1d470d0, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@24d09c1, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@54c62d71, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@65045a87, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@47f4e407, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@2d1dee39, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@48d5f34e]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.436 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.457 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.457 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
[INFO] Running de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests
09:54:24.458 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.458 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.458 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.458 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.475 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved @ProfileValueSourceConfiguration [null] for test class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.475 [main] DEBUG org.springframework.test.annotation.ProfileValueUtils - Retrieved ProfileValueSource type [class org.springframework.test.annotation.SystemProfileValueSource] for class [de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests]
09:54:24.483 [main] DEBUG org.testcontainers.utility.TestcontainersConfiguration - Testcontainers configuration overrides will be loaded from file:/Users/antonio/.testcontainers.properties
09:54:24.491 [main] DEBUG org.testcontainers.utility.CommandLine - Executing shell command: `docker-machine ls -q`
09:54:24.493 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Executing [docker-machine, ls, -q].
09:54:24.494 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Started Process[pid=1440, exitValue="not exited"]
09:54:24.604 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.WaitForProcess - Process[pid=1440, exitValue=0] stopped with exit code 0
09:54:24.604 [main] DEBUG org.testcontainers.utility.DockerMachineClient - DOCKER_MACHINE_NAME is not set; Using 'default' docker-machine
09:54:24.775 [ducttape-0] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - Pinging docker daemon...
09:54:24.785 [ducttape-0] DEBUG org.testcontainers.shaded.com.github.dockerjava.core.command.AbstrDockerCmd - Cmd:
09:54:24.807 [main] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - UnixSocketClientProviderStrategy: failed with exception RuntimeException (java.lang.UnsatisfiedLinkError: /Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: dlopen(/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp, 1): no suitable image found. Did find:
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper). Root cause UnsatisfiedLinkError (/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: dlopen(/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp, 1): no suitable image found. Did find:
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper)
09:54:24.807 [main] DEBUG org.testcontainers.utility.CommandLine - Executing shell command: `docker-machine ls -q`
09:54:24.808 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Executing [docker-machine, ls, -q].
09:54:24.810 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Started Process[pid=1442, exitValue="not exited"]
09:54:24.844 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.WaitForProcess - Process[pid=1442, exitValue=0] stopped with exit code 0
09:54:24.844 [main] DEBUG org.testcontainers.utility.DockerMachineClient - DOCKER_MACHINE_NAME is not set; Using 'default' docker-machine
09:54:24.844 [main] INFO org.testcontainers.dockerclient.DockerMachineClientProviderStrategy - Found docker-machine, and will use machine named default
09:54:24.844 [main] DEBUG org.testcontainers.utility.CommandLine - Executing shell command: `docker-machine status default`
09:54:24.844 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Executing [docker-machine, status, default].
09:54:24.846 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.ProcessExecutor - Started Process[pid=1444, exitValue="not exited"]
09:54:24.870 [main] DEBUG org.testcontainers.shaded.org.zeroturnaround.exec.WaitForProcess - Process[pid=1444, exitValue=1] stopped with exit code 1
09:54:24.870 [main] DEBUG org.testcontainers.dockerclient.DockerClientProviderStrategy - DockerMachineClientProviderStrategy: failed with exception ShellCommandException (Exception when executing docker-machine status default). Root cause InvalidExitValueException (Unexpected exit value: 1, allowed exit values: [0], executed command [docker-machine, status, default], output was 124 bytes:
error getting state for host default: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path)
09:54:24.871 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
09:54:24.871 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - UnixSocketClientProviderStrategy: failed with exception RuntimeException (java.lang.UnsatisfiedLinkError: /Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: dlopen(/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp, 1): no suitable image found. Did find:
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper). Root cause UnsatisfiedLinkError (/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: dlopen(/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp, 1): no suitable image found. Did find:
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper
/Users/antonio/Library/Caches/JNA/temp/jna8589515278144772572.tmp: no matching architecture in universal wrapper)
09:54:24.871 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - DockerMachineClientProviderStrategy: failed with exception ShellCommandException (Exception when executing docker-machine status default). Root cause InvalidExitValueException (Unexpected exit value: 1, allowed exit values: [0], executed command [docker-machine, status, default], output was 124 bytes:
error getting state for host default: VBoxManage not found. Make sure VirtualBox is installed and VBoxManage is in the path)
09:54:24.871 [main] ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.419 s <<< FAILURE! - in de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests
[ERROR] de.rieckpil.blog.SpringBootHibernateFlywayBestPracticesApplicationTests Time elapsed: 0.418 s <<< ERROR!
java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
As you can see I get:
... no suitable image found...
ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continue
java.lang.IllegalStateException: Could not find a valid Docker environment.
I don't know if there is a way to solve this problem. In my view should work fine because I can run the docker containers by terminal then I should be able to run testcontainers.
I'm having a similar issue with an M1 Mac and org.testcontainers postgresql
I've set my environment variable DOCKER_DEFAULT_PLATFORM=linux/amd64 in the hope it would work but I'm still seeing
com.github.dockerjava.api.exception.DockerClientException: Could not pull image: no matching manifest for linux/arm64/v8 in the manifest list entries
There doesn't seem to be a way of specifying platform and testcontainers doesn't seem to be respecting the env var - which seems to have taken effect with docker on the command line.
I'm surprised this has been around since Feb and there aren't more comments. 😞
Reacted by Gareth A, Diego Tobon, Chris Kocel, NPoxonDojo and Claus Ibsen
I'd like to explain why I think this is an important feature request. At work, my team uses the Jooq Gradle plugin to bring up an ephemeral MySQL database at build time to generate jooq Java code. The plugin accepts a JDBC URL, and we point this to testcontainers' magical JDBC URLs. Something like this:
We've worked around this by adding logic to our build script to switch on the host machine's architecture, and to pull a mariadb image on M1 machines. (MariaDB does publish linux/arm64/v8 images.) This works okay because MariaDB aims for high compatibility with MySQL -- and our CI infrastructure is still x86, so that's still the authoritative gencode. But inevitably, we're starting to run into incompatibilities between the two DBs. And it's becoming more of a problem as more of our team switches to M1 machines.
I would really like for testcontainers to have a way to express "pull an image for a specific platform, regardless of the host platform". This could be:
honoring the DOCKER_DEFAULT_PLATFORM env var
special setting in .testcontainers.properties
special syntax in the magical JDBC URLs
...something else I'm not thinking of
Maintainers, WDYT? I'm happy to help implement this feature if you agree it's valuable. Or if there's a better workaround than the MariaDB hack, I'd love to hear it.
Reacted by Yuqing Ma, Zane, Brendan Linn, alanquach, Schalk W. Cronjé, Martin Schalck, Sam Verhasselt, Dennis Becker, Thorsten Brunzendorf, Chris Kocel and 6 more
I do not know how the --platform command-line arguments relates to the docker API itself, but assuming there is a working relationship, then having an addition withPlatform(String) on the GenericContainer class would be useful too.
Reacted by Martin Schalck, Claus Ibsen, Alessandro Solimando, Kristina Head, fbartkow-from-f, ismail simsek and Ary Obenholzner
I have the same issue with MySQL 5.7 on Macbook Pro with M1 CPU.
GenericContainer allows to set the platform but this does not work with MySQLContainer:
JdbcDatabaseContainerjdbcDatabaseContainer =
newMySQLContainer(DockerImageName.parse("mysql").withTag("5.7"))
.withDatabaseName("foo")
.withUsername("bar")
.withPassword("baz")
.withInitScript("db/init.sql")
.withCreateContainerCmdModifier(cmd -> cmd.withPlatform("linux/x86_64") // <-- this is in context of GenericContainer instead of MySQLContainer
);
jdbcDatabaseContainer.start();
MySqlDbTestContainer.java:[22,44] incompatible types: org.testcontainers.containers.GenericContainer cannot be converted to org.testcontainers.containers.JdbcDatabaseContainer
It also does not work if I change the code to the following just results in immediatly not started MySQL container.
JdbcDatabaseContainerjdbcDatabaseContainer =
newMySQLContainer<>(DockerImageName.parse("mysql").withTag("5.7")) // adds <> so IntelliJ is happy
.withDatabaseName("foo")
.withUsername("bar")
.withPassword("baz")
.withInitScript("db/init.sql")
.withCreateContainerCmdModifier(cmd -> cmd.withPlatform("linux/x86_64"));
Reacted by Robin Mobers, Tristan Leo, Benjamin Kluck, Krischan Dickel, Hendrik Brinkmann, Marc Peters, Rea Sand, Jakob Hellermann, Jan Seeger, Marc Löhe and 11 more
After doing some research, I found out that testcontainers forces the use of Docker API 1.32. But the Docker API only started supporting platform from 1.41. So even specifying platform in withCreateContainerCmdModifier() is useless, @DennisBecker. I think there are several solutions to this:
use unversioned API
use 1.41 for the default version
provide some kind of detection mechanism to automatically identify the API version used by the server
provide some configuration to support custom API version
so the main ask here is that there be a way to globally set macos to use the linux/x86_64 images via a system property or something? (potentially for specific images). That seems reasonable to me, just want to make sure i understand.
Activity
ansotolab commentedon Feb 22, 2021
I have the same problem with a MacBook Pro Silicon M1 chip. I want to run a PostgreSQL container that has an ARM version indeed:
I can perfectly run by terminal:
However, I got an exception when I run the test in IntelliJ or by commands (I remark this to dismiss the idea that can be an IDE problem). I test this code on my old PC with an x86-64 processor and it runs fine, the code is:
When I execute
mvn testI get this:Error log:
As you can see I get:
... no suitable image found...ERROR org.testcontainers.dockerclient.DockerClientProviderStrategy - As no valid configuration was found, execution cannot continuejava.lang.IllegalStateException: Could not find a valid Docker environment.I don't know if there is a way to solve this problem. In my view should work fine because I can run the docker containers by terminal then I should be able to run testcontainers.
ansotolab commentedon Feb 22, 2021
The fact is I can run this test inside Docker as it's recommended for some scenarios in the docs.
The command is the following:
Successful log:
As you can see I get:
That works but is so slow for development, it will be perfect to find a solution for this.
LarsEckart commentedon Mar 22, 2021
Same for me. Tried with our production app and also testcontainers-workshop project. :(
@bsideup you're also using a M1 mac, you don't have such issues?
edit: this helped.
sebjsmith commentedon May 26, 2021
I'm having a similar issue with an M1 Mac and org.testcontainers postgresql
I've set my environment variable DOCKER_DEFAULT_PLATFORM=linux/amd64 in the hope it would work but I'm still seeing
com.github.dockerjava.api.exception.DockerClientException: Could not pull image: no matching manifest for linux/arm64/v8 in the manifest list entriesThere doesn't seem to be a way of specifying platform and testcontainers doesn't seem to be respecting the env var - which seems to have taken effect with docker on the command line.
I'm surprised this has been around since Feb and there aren't more comments. 😞
LarsEckart commentedon May 27, 2021
testImplementation 'net.java.dev.jna:jna:5.7.0'is what helps me on M1 Mac to get testcontainers to work.sebjsmith commentedon May 27, 2021
I got around my issue in the end. It was not postgres that was problematic once I dug into it.
I had to add checks.disable=true because there is no arm image available for the alpine one used on startup checks! 🤣
bsideup commentedon May 27, 2021
FTR it is also possible to set
tinyimage.container.imageto Alpine that supports ARM, e.g.alpine:3.13.5.We will also update the image we're using to a newer one that supports ARM
/cc @rnorth
gk0916 commentedon Jun 6, 2022
I solved the problem in the same way. add 'checks.disable=true' in the file '/Users/myuser/.testcontainers.properties' (MacOS)
Ubehebe commentedon Nov 28, 2022
I'd like to explain why I think this is an important feature request. At work, my team uses the Jooq Gradle plugin to bring up an ephemeral MySQL database at build time to generate jooq Java code. The plugin accepts a JDBC URL, and we point this to testcontainers' magical JDBC URLs. Something like this:
This works wonderfully on x86 machines. But on M1 machines, this causes testcontainers to look for a
linux/arm64/v8mysqlimage. Oracle only publishes MySQL 5.7.x images forlinux/amd64, so the Jooq Gradle plugin fails.We've worked around this by adding logic to our build script to switch on the host machine's architecture, and to pull a
mariadbimage on M1 machines. (MariaDB does publishlinux/arm64/v8images.) This works okay because MariaDB aims for high compatibility with MySQL -- and our CI infrastructure is still x86, so that's still the authoritative gencode. But inevitably, we're starting to run into incompatibilities between the two DBs. And it's becoming more of a problem as more of our team switches to M1 machines.I would really like for testcontainers to have a way to express "pull an image for a specific platform, regardless of the host platform". This could be:
DOCKER_DEFAULT_PLATFORMenv var.testcontainers.propertiesMaintainers, WDYT? I'm happy to help implement this feature if you agree it's valuable. Or if there's a better workaround than the MariaDB hack, I'd love to hear it.
ysb33r commentedon Dec 7, 2022
Very much in agreement with @Ubehebe.
I do not know how the
--platformcommand-line arguments relates to the docker API itself, but assuming there is a working relationship, then having an additionwithPlatform(String)on the GenericContainer class would be useful too.ysb33r commentedon Dec 7, 2022
To add to the above, the preliminary Gradle JOOQ Generator plugin utilises pretty much the same strategy.
SaymV commentedon Feb 1, 2023
Just to pile on here and leave a breadcrumb in case others face the same issue:
The SingleStore Developer Image also requires the
--platformargument in order to run on m1 macs.DennisBecker commentedon Feb 1, 2023
I have the same issue with MySQL 5.7 on Macbook Pro with M1 CPU.
GenericContainer allows to set the platform but this does not work with MySQLContainer:
It also does not work if I change the code to the following just results in immediatly not started MySQL container.
moonfruit commentedon Feb 27, 2023
After doing some research, I found out that
testcontainersforces the use of Docker API 1.32. But the Docker API only started supportingplatformfrom 1.41. So even specifying platform inwithCreateContainerCmdModifier()is useless, @DennisBecker. I think there are several solutions to this:DockerClientProviderStrategy:
testcontainers-java/core/src/main/java/org/testcontainers/dockerclient/DockerClientProviderStrategy.java
Lines 388 to 390 in cfb0c74
Docker API Document:
sandeepgorule commentedon Jan 3, 2024
How to change the default version to 1.41 ?
moonfruit commentedon Jan 4, 2024
You can directly modify docker-java to use the API version in several ways:
See docker-java/getting_started.md for details
alexanderankin commentedon Jan 4, 2024
you can set a breakpoint here:
org.testcontainers.shaded.com.github.dockerjava.core.DefaultDockerClientConfig#overrideDockerPropertiesWithSystemPropertieshttps://github.com/docker-java/docker-java/blob/84d7750d7f290c66f0ae18c88ab92a3cde2c804d/docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java#L209-L219
and see how it works:
https://github.com/docker-java/docker-java/blob/84d7750d7f290c66f0ae18c88ab92a3cde2c804d/docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java#L74
https://github.com/docker-java/docker-java/blob/84d7750d7f290c66f0ae18c88ab92a3cde2c804d/docker-java-core/src/main/java/com/github/dockerjava/core/DefaultDockerClientConfig.java#L49
so you just set
and it seems to pick it up.
alexanderankin commentedon Jan 4, 2024
so the main ask here is that there be a way to globally set macos to use the
linux/x86_64images via a system property or something? (potentially for specific images). That seems reasonable to me, just want to make sure i understand.sandeepgorule commentedon Jan 4, 2024
Yes, it is.
jan-nepras-engel commentedon Jan 28, 2025
@alexanderankin is there any plan or progress on this topic?
alexanderankin commentedon Jan 29, 2025
@jan-nepras-engel I've created an issue here to get input from tc-java maintainers if this addition is welcome - #9908