Testcontainers could not find a valid Docker Environment
javahippie opened this issue · 2 comments
After an upgrade to Testcontainers 0.3.0, our application is not able to execute testcontainers on Mac or Gitlab Pipeline anymore. A different application, that uses boot instead of Leiningen, still works (tested on Mac only).
Java Versions: OpenJDK 8 or 11
Clojure Version: 1.10.1
20-10-24 19:15:08 runner-z3wu8uu--project-18082984-concurrent-0 INFO [org.testcontainers.dockerclient.DockerMachineClientProviderStrategy:58] - docker-machine executable was not found on PATH ([/usr/local/openjdk-11/bin, /usr/local/sbin, /usr/local/bin, /usr/sbin, /usr/bin, /sbin, /bin, .])
64220-10-24 19:15:08 runner-z3wu8uu--project-18082984-concurrent-0 ERROR [org.testcontainers.dockerclient.DockerClientProviderStrategy:207] - Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
64320-10-24 19:15:08 runner-z3wu8uu--project-18082984-concurrent-0 ERROR [org.testcontainers.dockerclient.DockerClientProviderStrategy:209] - EnvironmentAndSystemPropertyClientProviderStrategy: failed with exception NoClassDefFoundError (com/fasterxml/jackson/annotation/JsonMerge). Root cause ClassNotFoundException (com.fasterxml.jackson.annotation.JsonMerge)
64420-10-24 19:15:08 runner-z3wu8uu--project-18082984-concurrent-0 ERROR [org.testcontainers.dockerclient.DockerClientProviderStrategy:209] - UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
64520-10-24 19:15:08 runner-z3wu8uu--project-18082984-concurrent-0 ERROR [org.testcontainers.dockerclient.DockerClientProviderStrategy:211] - As no valid configuration was found, execution cannot continue
646lein test :only calendar-app.integration.user-integration/calendar-app.integration.user-integration
647ERROR in (calendar-app.integration.user-integration) (DockerClientProviderStrategy.java:214)
648Uncaught exception in test fixture
649expected: nil
650 actual: java.lang.IllegalStateException: Could not find a valid Docker environment. Please see logs and check configuration
651 at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7 (DockerClientProviderStrategy.java:214)
652 java.util.Optional.orElseThrow (Optional.java:408)
653 org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy (DockerClientProviderStrategy.java:206)
654 org.testcontainers.DockerClientFactory.getOrInitializeStrategy (DockerClientFactory.java:132)
655 org.testcontainers.DockerClientFactory.dockerHostIpAddress (DockerClientFactory.java:337)
656 org.testcontainers.containers.ContainerState.getHost (ContainerState.java:58)
657 clj_test_containers.core$init.invokeStatic (core.clj:150)
658 clj_test_containers.core$init.invoke (core.clj:123)
659 clj_test_containers.core$create.invokeStatic (core.clj:160)
660 clj_test_containers.core$create.invoke (core.clj:157)
661 calendar_app.integration.user_integration$eval28984$fn__28985.invoke (user_integration.clj:8)
662 clojure.test$compose_fixtures$fn__9731$fn__9732.invoke (test.clj:694)
663 clojure.test$default_fixture.invokeStatic (test.clj:687)
664 clojure.test$default_fixture.invoke (test.clj:683)
665 clojure.test$compose_fixtures$fn__9731.invoke (test.clj:694)
666 clojure.test$test_vars.invokeStatic (test.clj:731)
667 clojure.test$test_all_vars.invokeStatic (test.clj:737)
668 clojure.test$test_ns.invokeStatic (test.clj:758)
669 clojure.test$test_ns.invoke (test.clj:743)
670 user$eval224$fn__287.invoke (form-init2580141572147231764.clj:1)
671 clojure.lang.AFn.applyToHelper (AFn.java:156)
672 clojure.lang.AFn.applyTo (AFn.java:144)
673 clojure.core$apply.invokeStatic (core.clj:667)
674 clojure.core$apply.invoke (core.clj:660)
675 leiningen.core.injected$compose_hooks$fn__154.doInvoke (form-init2580141572147231764.clj:1)
676 clojure.lang.RestFn.applyTo (RestFn.java:137)
677 clojure.core$apply.invokeStatic (core.clj:665)
678 clojure.core$apply.invoke (core.clj:660)
679 leiningen.core.injected$run_hooks.invokeStatic (form-init2580141572147231764.clj:1)
680 leiningen.core.injected$run_hooks.invoke (form-init2580141572147231764.clj:1)
681 leiningen.core.injected$prepare_for_hooks$fn__159$fn__160.doInvoke (form-init2580141572147231764.clj:1)
682 clojure.lang.RestFn.applyTo (RestFn.java:137)
683 clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
684 clojure.lang.RestFn.invoke (RestFn.java:408)
685 clojure.core$map$fn__5866.invoke (core.clj:2755)
686 clojure.lang.LazySeq.sval (LazySeq.java:42)
687 clojure.lang.LazySeq.seq (LazySeq.java:51)
688 clojure.lang.Cons.next (Cons.java:39)
689 clojure.lang.RT.next (RT.java:713)
690 clojure.core$next__5386.invokeStatic (core.clj:64)
691 clojure.core$reduce1.invokeStatic (core.clj:944)
692 clojure.core$reduce1.invokeStatic (core.clj:934)
693 clojure.core$merge_with.invokeStatic (core.clj:3059)
694 clojure.core$merge_with.doInvoke (core.clj:3051)
695 clojure.lang.RestFn.applyTo (RestFn.java:139)
696 clojure.core$apply.invokeStatic (core.clj:667)
697 clojure.test$run_tests.invokeStatic (test.clj:768)
698 clojure.test$run_tests.doInvoke (test.clj:768)
699 clojure.lang.RestFn.applyTo (RestFn.java:137)
700 clojure.core$apply.invokeStatic (core.clj:665)
701 clojure.core$apply.invoke (core.clj:660)
702 user$eval224$fn__299$fn__332.invoke (form-init2580141572147231764.clj:1)
703 user$eval224$fn__299$fn__300.invoke (form-init2580141572147231764.clj:1)
704 user$eval224$fn__299.invoke (form-init2580141572147231764.clj:1)
705 user$eval224.invokeStatic (form-init2580141572147231764.clj:1)
706 user$eval224.invoke (form-init2580141572147231764.clj:1)
707 clojure.lang.Compiler.eval (Compiler.java:7177)
708 clojure.lang.Compiler.eval (Compiler.java:7167)
709 clojure.lang.Compiler.load (Compiler.java:7636)
710 clojure.lang.Compiler.loadFile (Compiler.java:7574)
711 clojure.main$load_script.invokeStatic (main.clj:475)
712 clojure.main$init_opt.invokeStatic (main.clj:477)
713 clojure.main$init_opt.invoke (main.clj:477)
714 clojure.main$initialize.invokeStatic (main.clj:508)
715 clojure.main$null_opt.invokeStatic (main.clj:542)
716 clojure.main$null_opt.invoke (main.clj:539)
717 clojure.main$main.invokeStatic (main.clj:664)
718 clojure.main$main.doInvoke (main.clj:616)
719 clojure.lang.RestFn.applyTo (RestFn.java:137)
720 clojure.lang.Var.applyTo (Var.java:705)
721 clojure.main.main (main.java:40)
Apparently, the latest testcontainers-java version that was included by clj-test-containers 0.3.0 also includes a later docker-java version. This version relies on newer Jackson versions, which cause a conflict with our application. This is not an issue with clj-test-containers, and was also rejected by testcontainers-java. See:
The issue can be solved with explicitly defined Jackson versions in your projects dependencies:
https://clojureverse.org/t/depending-on-the-right-versions-of-jackson-libraries/5111/13