-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Comments
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. |
OK, thanks for the response, will notify if something changes on this topic as Rancher Desktops approaches the first regular release. |
Unfortunately no luck either with final 1.0.0 version of Rancher Desktop and Test Containers 1.16.3. |
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. |
RancherDesktop exposes DockerAPI via Moby. Docker API in Rancher Desktop on Windows is by default exposed at standard location:
OK, fine, disk space check does not work in RancherDesktop.
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:
Are there some hints about incompatibility so I can pass the info to the Rancher Desktop team? |
Did some debugging. Seems that
This is root cause for both cases, when checking available disk space and when checking internal container listening ports. |
Seems that et the end of exec command (Docker API call) Docker returns:
While Moby in Rancher Desktop:
Would it be something to notify Rancher Desktop or Moby project members? |
I think this is related to this issue in Rancher-Desktop: |
Seems they have fixed the issue in Rancher-Desktop: |
Thanks for notification, will try when they release it. |
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. |
Thanks for letting us know @mcekovic, this is great news indeed! 🙌 |
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). |
@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 |
Are you running Rancher Desktop on Mac OS? |
I am on macos. I guess it went on and seemed to work, but I had never seen these warnings before |
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 |
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. |
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. |
Yes, it worked for him on macOS. |
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 |
@kiview was this on M1 arm64 architecture? I must admit I'm having issues |
@edeandrea would need to answer this. |
No it was intel |
@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 :) |
For future reference, I found this related upstream issue at Rancher: |
There is Rancher Desktop section that has been added about how to set up Testcontainers. |
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:
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 plainredis
image for the test).The text was updated successfully, but these errors were encountered: