Repository navigation
Description
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).
Activity
kiview commentedon Dec 20, 2021
Hi @mcekovic, thanks for trying out Testcontainers with Rancher Desktop. In case Rancher Desktop tries to be fully compatible with the Docker API, I would suggest reporting this issue with Rancher Desktop since Testconainters works fine with Docker itself.
Therefore, I will close this issue, but feel free to keep us in the loop.
mcekovic commentedon Dec 20, 2021
OK, thanks for the response, will notify if something changes on this topic as Rancher Desktops approaches the first regular release.
mcekovic commentedon Jan 27, 2022
Unfortunately no luck either with final 1.0.0 version of Rancher Desktop and Test Containers 1.16.3.
kiview commentedon Jan 27, 2022
Thanks for trying out. Does Rancher Desktop now expose the Docker API in some way? Maybe there is some configuration workaround that can make this work.
mcekovic commentedon Jan 27, 2022
RancherDesktop exposes DockerAPI via Moby. Docker API in Rancher Desktop on Windows is by default exposed at standard location:
npipe:////./pipe/docker_engine. TestContainers manages to start communication to the Docker API, makes some calls, but then hang during the check for disk space:OK, fine, disk space check does not work in RancherDesktop.
However, when I disable TestContainers checks (
checks.disable=true) then it loads the image, it can be seen with Docker command line that container is created and started:TestContainers seems to verify exposed Redis port successfully:
[testcontainers-wait-1] DEBUG org.testcontainers.containers.wait.strategy.HostPortWaitStrategy - External port check passed for [6379] mapped as [49166] in PT0.3359626S
but after that TestContainers waits at (stacktrace):
and finally timeouts with:
However, during the wait, I can see with netstat on the Windows host that random port 49166 is indeed listening:
TCP 127.0.0.1:49166 0.0.0.0:0 LISTENING 10276Are there some hints about incompatibility so I can pass the info to the Rancher Desktop team?
mcekovic commentedon Jan 27, 2022
Did some debugging. Seems that
org.testcontainers.containers.wait.internal.InternalCommandPortListeningCheckhangs when executing in container via Java Docker client:This is root cause for both cases, when checking available disk space and when checking internal container listening ports.
mcekovic commentedon Jan 27, 2022
Seems that et the end of exec command (Docker API call) Docker returns:
[docker-java-stream--729518257] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "end of stream"While Moby in Rancher Desktop:
[docker-java-stream-1614402714] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.wire - http-outgoing-1 << "[\r][\n]"Would it be something to notify Rancher Desktop or Moby project members?
jrmcdonald commentedon Jan 28, 2022
I think this is related to this issue in Rancher-Desktop:
rancher-sandbox/rancher-desktop#1171
kiview commentedon Feb 1, 2022
Seems they have fixed the issue in Rancher-Desktop:
rancher-sandbox/rancher-desktop#1374
mcekovic commentedon Feb 1, 2022
Thanks for notification, will try when they release it.
mcekovic commentedon Feb 4, 2022
Just note that TestContainers works nicely with Rancher Desktop 1.0.1 with the fix for rancher-sandbox/rancher-desktop#1374 for me and for several of my colleagues.
Thank you for the support.
kiview commentedon Feb 4, 2022
Thanks for letting us know @mcekovic, this is great news indeed! 🙌
Anything out of the ordinary to make it work together, or is the setup straightforward?
mcekovic commentedon 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).
edeandrea commentedon Feb 9, 2022
@mcekovic Did you have to do anything else? It doesn't work for me...I'm seeing things like this:
mcekovic commentedon Feb 9, 2022
Are you running Rancher Desktop on Mac OS?
For me it worked out-of-box on Windows 10 (just switching to dockerd).
Seems the stack traces you get are only warnings, it manages to connect to Ryuk image finally. Do you have some other errors later?
edeandrea commentedon Feb 9, 2022
I am on macos. I guess it went on and seemed to work, but I had never seen these warnings before
kiview commentedon Feb 10, 2022
I think it took just a bit until the port was mapped and reachable for the host.
What TC does internally is launch Ryuk, and then have a thread communicating with Ryuk. Initially, we wait up to
ryuk.container.timeoutseconds (which defaults to 30s) to be able to communicate with Ryuk (and retry), so that's why you see these logs.edeandrea commentedon Feb 10, 2022
Thanks @kiview . Part of it must be that rancher desktop is spinning stuff up on a k8s distro rather than just launching a container on the host, which takes time.
Sandmania commentedon Feb 14, 2022
Sorry, just to clarify, @edeandrea did yout get Testcontainers + Rancher Desktop + macOS combination to work?
Edit: it does indeed work. My legacy project just had some dependency issues.
kiview commentedon Feb 14, 2022
Yes, it worked for him on macOS.
pidzama commentedon Apr 8, 2022
The same issue can be reproduced on Rancher Desktop 1.2.1 + Windows 10, with this sample project https://github.com/lreimer/hands-on-testcontainers.git
Krijger commentedon Apr 26, 2022
@kiview was this on M1 arm64 architecture? I must admit I'm having issues
kiview commentedon Apr 26, 2022
@edeandrea would need to answer this.
edeandrea commentedon Apr 26, 2022
No it was intel
Krijger commentedon Apr 28, 2022
@edeandrea thanks. I had a different issue, and it was fixed by fixing my JNA dependency according to #3834 . Now I need to see how to run the MS SQL tests :)
kiview commentedon Sep 12, 2022
For future reference, I found this related upstream issue at Rancher:
rancher-sandbox/rancher-desktop#2609
eddumelendez commentedon Sep 28, 2023
There is Rancher Desktop section that has been added about how to set up Testcontainers.