Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestContainers Could not find a valid Docker environment

Running the same version of TestContainers 1.15.3 in one project is working correctly detecting docker etc but in another it is unable to start due to some sort of signing issue?

  2021-08-23 20:35:13.524  INFO [,,,] 49733 --- [ers-lifecycle-0] .t.d.DockerMachineClientProviderStrategy : docker-machine executable was not found on PATH ([/usr/local/bin, /usr/bin, /bin, /usr/sbin, /sbin, /usr/local/bin])
2021-08-23 20:35:14.104 ERROR [,,,] 49733 --- [ers-lifecycle-0] o.t.d.DockerClientProviderStrategy       : Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
2021-08-23 20:35:14.105 ERROR [,,,] 49733 --- [ers-lifecycle-0] o.t.d.DockerClientProviderStrategy       :     UnixSocketClientProviderStrategy: failed with exception RuntimeException (java.lang.UnsatisfiedLinkError: /private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp: dlopen(/private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp, 1): no suitable image found.  Did find:
  /private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp: code signature in (/private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.). Root cause UnsatisfiedLinkError (/private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp: dlopen(/private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp, 1): no suitable image found.  Did find:
  /private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp: code signature in (/private/var/folders/vr/3wn83fp91j58p74ymdrghq480000gq/T/jna--2036694134/jna17985952756996537821.tmp) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.)
2021-08-23 20:35:14.105 ERROR [,,,] 49733 --- [ers-lifecycle-0] o.t.d.DockerClientProviderStrategy       : As no valid configuration was found, execution cannot continue

JDK:

brew info adoptopenjdk12
adoptopenjdk12: 12.0.2,10
https://adoptopenjdk.net/
/usr/local/Caskroom/adoptopenjdk12/12.0.2,10 (190MB)
From: https://github.com/adoptopenjdk/homebrew-openjdk/blob/HEAD/Casks/adoptopenjdk12.rb
==> Name
AdoptOpenJDK 12
==> Description
AdoptOpenJDK OpenJDK (Java) Development Kit
==> Artifacts
OpenJDK12U-jdk_x64_mac_hotspot_12.0.2_10.pkg (Pkg)

Working project:

2021-08-23 20:18:23.586  INFO [,,] 47914 --- [ers-lifecycle-0] o.t.d.DockerClientProviderStrategy       : Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2021-08-23 20:18:24.154  INFO [,,] 47914 --- [ers-lifecycle-0] o.t.d.DockerClientProviderStrategy       : Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
2021-08-23 20:18:24.156  INFO [,,] 47914 --- [ers-lifecycle-0] org.testcontainers.DockerClientFactory   : Docker host IP address is localhost
2021-08-23 20:18:24.198  INFO [,,] 47914 --- [ers-lifecycle-0] org.testcontainers.DockerClientFactory   : Connected to docker: 
  Server Version: 20.10.7
  API Version: 1.41
  Operating System: Docker Desktop
  Total Memory: 5945 MB

JDK:

java --version
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment (build 16.0.2+7-67)
OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

Any pointers greatly appreciated.

Mac OS Big Sur Docker Desktop Version 3.5.2 (3.5.2.18)

like image 264
Patrick Bray Avatar asked Oct 21 '25 13:10

Patrick Bray


1 Answers

This looks to be caused by an issue in Adopt Open JDK as documented here:

https://github.com/adoptium/temurin-build/issues/1211#issuecomment-521392147 github.com/testcontainers/testcontainers-java/issues/1773

Switching over to Oracle JDK 12 has resolved the issue.

like image 159
Patrick Bray Avatar answered Oct 23 '25 04:10

Patrick Bray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!