Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TestContainers not working with Rancher Desktop #4791

Closed
mcekovic opened this issue Dec 20, 2021 · 27 comments
Closed

TestContainers not working with Rancher Desktop #4791

mcekovic opened this issue Dec 20, 2021 · 27 comments

Comments

@mcekovic
Copy link

mcekovic commented Dec 20, 2021

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).

@kiview
Copy link
Member

kiview commented 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
Copy link
Author

OK, thanks for the response, will notify if something changes on this topic as Rancher Desktops approaches the first regular release.

@mcekovic
Copy link
Author

Unfortunately no luck either with final 1.0.0 version of Rancher Desktop and Test Containers 1.16.3.

@kiview
Copy link
Member

kiview commented 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
Copy link
Author

mcekovic commented 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:

	at com.github.dockerjava.api.async.ResultCallbackTemplate.awaitCompletion(ResultCallbackTemplate.java:91)
	at org.testcontainers.DockerClientFactory.checkDiskSpace(DockerClientFactory.java:294)

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:

$ docker container ls
CONTAINER ID   IMAGE                              COMMAND                  CREATED          STATUS          PORTS
    NAMES
105312cf6289   redis:latest                       "docker-entrypoint.s…"   7 seconds ago    Up 7 seconds    0.0.0.0:49166->6379/tcp, :::49166->6379/tcp   distracted_rhodes

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):

	at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:51)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:51)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
	at org.testcontainers.containers.GenericContainer$$Lambda$447/0x0000000800dfc660.call(Unknown Source)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)

and finally timeouts with:

[main] DEBUG 🐳 [redis:latest] - Wait strategy threw an exception
[testcontainers-wait-0] DEBUG com.github.dockerjava.zerodep.shaded.org.apache.hc.client5.http.impl.classic.InternalHttpClient - ep-0000000F: cancel
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [49166] should be listening)
	at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:90)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:51)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)

...

[main] ERROR 🐳 [redis:latest] - Log output from the failed container:
1:C 27 Jan 2022 20:02:50.144 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 27 Jan 2022 20:02:50.144 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 27 Jan 2022 20:02:50.144 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
1:M 27 Jan 2022 20:02:50.145 * monotonic clock: POSIX clock_gettime
1:M 27 Jan 2022 20:02:50.145 * Running mode=standalone, port=6379.
1:M 27 Jan 2022 20:02:50.145 # Server initialized
1:M 27 Jan 2022 20:02:50.145 * Ready to accept connections


org.testcontainers.containers.ContainerLaunchException: Container startup failed
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:336)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:317)

...

Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:329)
	... 69 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:525)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:331)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 70 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [49166] should be listening)
	at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:90)
	at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:51)
	at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:929)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:468)
	... 72 more

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 10276

Are there some hints about incompatibility so I can pass the info to the Rancher Desktop team?

@mcekovic
Copy link
Author

mcekovic commented Jan 27, 2022

Did some debugging. Seems that org.testcontainers.containers.wait.internal.InternalCommandPortListeningCheck hangs when executing in container via Java Docker client:

   public ExecStartCmd execStartCmd(String execId) {
      return new ExecStartCmdImpl(this.getDockerCmdExecFactory().createExecStartCmdExec(), execId);
   }

This is root cause for both cases, when checking available disk space and when checking internal container listening ports.

@mcekovic
Copy link
Author

mcekovic commented 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
Copy link

I think this is related to this issue in Rancher-Desktop:

rancher-sandbox/rancher-desktop#1171

@kiview
Copy link
Member

kiview commented Feb 1, 2022

Seems they have fixed the issue in Rancher-Desktop:
rancher-sandbox/rancher-desktop#1374

@mcekovic
Copy link
Author

mcekovic commented Feb 1, 2022

Thanks for notification, will try when they release it.

@mcekovic
Copy link
Author

mcekovic commented 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
Copy link
Member

kiview commented 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
Copy link
Author

mcekovic commented 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
Copy link
Contributor

edeandrea commented Feb 9, 2022

@mcekovic Did you have to do anything else? It doesn't work for me...I'm seeing things like this:

10:34:15 INFO  [or.te.do.DockerClientProviderStrategy] (build-32) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
10:34:16 INFO  [or.te.do.DockerClientProviderStrategy] (build-32) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
10:34:16 INFO  [or.te.DockerClientFactory] (build-32) Docker host IP address is localhost
10:34:16 INFO  [or.te.DockerClientFactory] (build-32) Connected to docker: 
  Server Version: 20.10.11
  API Version: 1.41
  Operating System: Alpine Linux v3.14
  Total Memory: 3942 MB
10:34:16 INFO  [or.te.ut.ImageNameSubstitutor] (build-32) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
10:34:16 WARN  [io.qu.de.st.ClassTransformingBuildStep] (build-7) Cannot transform io.smallrye.context.Jdk12CompletionStageWrapper as its containing application archive could not be found.
10:34:16 WARN  [io.qu.de.st.ClassTransformingBuildStep] (build-7) Cannot transform io.smallrye.context.Jdk12CompletableFutureWrapper as its containing application archive could not be found.
10:34:17 WARN  [or.te.ut.ResourceReaper] (testcontainers-ryuk) Can not connect to Ryuk at localhost:49157: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.testcontainers.utility.ResourceReaper.lambda$null$3(ResourceReaper.java:194)
	at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
	at org.testcontainers.utility.ResourceReaper.lambda$start$4(ResourceReaper.java:190)
	at java.base/java.lang.Thread.run(Thread.java:834)

10:34:17 WARN  [or.te.ut.ResourceReaper] (testcontainers-ryuk) Can not connect to Ryuk at localhost:49157: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.testcontainers.utility.ResourceReaper.lambda$null$3(ResourceReaper.java:194)
	at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
	at org.testcontainers.utility.ResourceReaper.lambda$start$4(ResourceReaper.java:190)
	at java.base/java.lang.Thread.run(Thread.java:834)

10:34:17 WARN  [or.te.ut.ResourceReaper] (testcontainers-ryuk) Can not connect to Ryuk at localhost:49157: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.testcontainers.utility.ResourceReaper.lambda$null$3(ResourceReaper.java:194)
	at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
	at org.testcontainers.utility.ResourceReaper.lambda$start$4(ResourceReaper.java:190)
	at java.base/java.lang.Thread.run(Thread.java:834)

10:34:18 WARN  [or.te.ut.ResourceReaper] (testcontainers-ryuk) Can not connect to Ryuk at localhost:49157: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.testcontainers.utility.ResourceReaper.lambda$null$3(ResourceReaper.java:194)
	at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
	at org.testcontainers.utility.ResourceReaper.lambda$start$4(ResourceReaper.java:190)
	at java.base/java.lang.Thread.run(Thread.java:834)

10:34:18 WARN  [or.te.ut.ResourceReaper] (testcontainers-ryuk) Can not connect to Ryuk at localhost:49157: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
	at java.base/java.net.Socket.connect(Socket.java:591)
	at org.testcontainers.utility.ResourceReaper.lambda$null$3(ResourceReaper.java:194)
	at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
	at org.testcontainers.utility.ResourceReaper.lambda$start$4(ResourceReaper.java:190)
	at java.base/java.lang.Thread.run(Thread.java:834)

10:34:18 INFO  [or.te.DockerClientFactory] (build-32) Ryuk started - will monitor and terminate Testcontainers containers on JVM exit

@mcekovic
Copy link
Author

mcekovic commented 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
Copy link
Contributor

I am on macos. I guess it went on and seemed to work, but I had never seen these warnings before

@kiview
Copy link
Member

kiview commented 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.timeout seconds (which defaults to 30s) to be able to communicate with Ryuk (and retry), so that's why you see these logs.

@edeandrea
Copy link
Contributor

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
Copy link

Sandmania commented 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
Copy link
Member

kiview commented Feb 14, 2022

Yes, it worked for him on macOS.

@pidzama
Copy link

pidzama commented 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
Copy link

Krijger commented Apr 26, 2022

@kiview was this on M1 arm64 architecture? I must admit I'm having issues

@kiview
Copy link
Member

kiview commented Apr 26, 2022

@edeandrea would need to answer this.

@edeandrea
Copy link
Contributor

No it was intel

@Krijger
Copy link

Krijger commented 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
Copy link
Member

kiview commented Sep 12, 2022

For future reference, I found this related upstream issue at Rancher:
rancher-sandbox/rancher-desktop#2609

@eddumelendez
Copy link
Member

There is Rancher Desktop section that has been added about how to set up Testcontainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants