question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TestContainers not working with Rancher Desktop

See original GitHub issue

Given the license change for Docker Desktop, everybody is searching for the alternatives. Docker installed on WSL2 works nicely with TestConteiners for me (after exposing 2375 port), but cannot make Rancher Desktop working. Rancher Desktop in the latest 0.7 version introduced option to use dockerd (moby) as container runtime, all with ‘standard’ Docker API exposed. TestConteiners are able to find DockerAPI within Rancher Desktop (0.7+), however for some reason TestContainer checks hang:

14:42:15.044 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ex-0000000A: preparing request execution
14:42:15.044 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.protocol.RequestAddCookies - Cookie spec selected: strict
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.protocol.RequestAuthCache - Auth cache not set in the context
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.ProtocolExec - ex-0000000A: target auth state: UNCHALLENGED
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.ProtocolExec - ex-0000000A: proxy auth state: UNCHALLENGED
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.ConnectExec - ex-0000000A: acquiring connection with route {}->npipe://localhost:2375
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ex-0000000A: acquiring endpoint (3 MINUTES)
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ex-0000000A: endpoint lease request (3 MINUTES) [route: {}->npipe://localhost:2375][total available: 1; route allocated: 1 of 2147483647; total allocated: 1 of 2147483647]
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ex-0000000A: endpoint leased [route: {}->npipe://localhost:2375][total available: 0; route allocated: 1 of 2147483647; total allocated: 1 of 2147483647]
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ex-0000000A: acquired ep-00000009
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ex-0000000A: acquired endpoint ep-00000009
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.MainClientExec - ex-0000000A: executing POST /v1.32/exec/829f47a2e65220db1ead02666338ce2504115d29b15cb0dfb01fb6c64c2c3273/start HTTP/1.1
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ep-00000009: start execution ex-0000000A
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager - ep-00000009: executing exchange ex-0000000A over http-outgoing-1
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> POST /v1.32/exec/829f47a2e65220db1ead02666338ce2504115d29b15cb0dfb01fb6c64c2c3273/start HTTP/1.1
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> accept: application/json
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> content-type: application/json
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> Accept-Encoding: gzip, x-gzip, deflate
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> Content-Length: 26
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> Host: localhost:2375
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> Connection: keep-alive
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 >> User-Agent: Apache-HttpClient/5.0.3 (Java/17.0.1)
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "POST /v1.32/exec/829f47a2e65220db1ead02666338ce2504115d29b15cb0dfb01fb6c64c2c3273/start HTTP/1.1[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "accept: application/json[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "content-type: application/json[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "Accept-Encoding: gzip, x-gzip, deflate[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "Content-Length: 26[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "Host: localhost:2375[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "Connection: keep-alive[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "User-Agent: Apache-HttpClient/5.0.3 (Java/17.0.1)[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "[\r][\n]"
14:42:15.045 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 >> "{"Detach":null,"Tty":null}"
14:42:15.046 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "HTTP/1.1 200 OK[\r][\n]"
14:42:15.046 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Api-Version: 1.41[\r][\n]"
14:42:15.046 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Content-Type: application/vnd.docker.raw-stream[\r][\n]"
14:42:15.046 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Docker-Experimental: false[\r][\n]"
14:42:15.046 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Ostype: linux[\r][\n]"
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Server: Docker/20.10.11 (linux)[\r][\n]"
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Date: Mon, 20 Dec 2021 13:42:15 GMT[\r][\n]"
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "Transfer-Encoding: chunked[\r][\n]"
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[\r][\n]"
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << HTTP/1.1 200 OK
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Api-Version: 1.41
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Content-Type: application/vnd.docker.raw-stream
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Docker-Experimental: false
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Ostype: linux
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Server: Docker/20.10.11 (linux)
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Date: Mon, 20 Dec 2021 13:42:15 GMT
14:42:15.047 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.headers - http-outgoing-1 << Transfer-Encoding: chunked
14:42:15.048 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.MainClientExec - ex-0000000A: connection can be kept alive for 3 MINUTES
14:42:15.161 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "40c[\r][\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[0x1][0x0][0x0][0x0][0x0][0x0][0x4][0x4]Filesystem           1024-blocks    Used Available Capacity Mounted on[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "overlay              263174212    864228 248871828   0% /[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                    65536         0     65536   0% /dev[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                  6502652         0   6502652   0% /sys/fs/cgroup[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "/dev/sdd             263174212    864228 248871828   0% /etc/resolv.conf[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "/dev/sdd             263174212    864228 248871828   0% /etc/hostname[\n]"
14:42:15.162 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "/dev/sdd             263174212    864228 248871828   0% /etc/hosts[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "shm                      65536         0     65536   0% /dev/shm[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "none                   6502652       960   6501692   0% /run/docker.sock[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                  6502652         0   6502652   0% /proc/acpi[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                    65536         0     65536   0% /proc/kcore[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                    65536         0     65536   0% /proc/keys[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                    65536         0     65536   0% /proc/timer_list[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                    65536         0     65536   0% /proc/sched_debug[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "tmpfs                  6502652         0   6502652   0% /sys/firmware[\n]"
14:42:15.163 [docker-java-stream-1961497227] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[\r][\n]"

Tried also disabling TestContainers checks with checks.disable=true, that way target image gets loaded, but TestContainers fails on waiting for the test container to start by waiting for exposed ports to be available (I was using plain redis image for the test).

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
mcekoviccommented, Feb 4, 2022

Just installing Rancher Desktop and switching to use dockerd (moby) container runtime (default is containerd) on the ‘Kubernetes Settings’ screen (there is a screenshot here) and everything works out-of-the box 😃.

No need for setting DOCKER_HOST env. variable or anything else (like when manually using Docker installed inside WSL).

1reaction
kiviewcommented, Feb 14, 2022

Yes, it worked for him on macOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Running Testcontainers with Rancher Desktop and Apple ...
Actual Behavior Running a test using Testcontainers on a MacBook Pro M1 leads to exceptions and a failed test with Rancher Desktop.
Read more >
testContainers and Rancher - intellij idea - Stack Overflow
UPDATE Feb 2022: As reported here TestContainers works nicely with Rancher Desktop 1.0.1 . Based on the following two closed issues - first, ......
Read more >
General Docker requirements - Testcontainers for Java
Testcontainers requires a Docker-API compatible container runtime. During development, Testcontainers is actively tested against recent versions of Docker on ...
Read more >
Rancher desktop - port 2375?
However, have issue with popular Java library TestContainers, it seems not working. TestContainers is able to find Docker API in Rancher Desktop ......
Read more >
Colima, Apple M1 and Testcontainers - Vivid Code
How to set up Testcontainers to work with Colima on Apple M1. ... Colima and Rancher Desktop are common choices for macOS users....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found