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

[Bug]: Testcontainers unable to connect to Ruyk #9467

Open
patrickuhlmann opened this issue Oct 28, 2024 · 1 comment
Open

[Bug]: Testcontainers unable to connect to Ruyk #9467

patrickuhlmann opened this issue Oct 28, 2024 · 1 comment
Labels

Comments

@patrickuhlmann
Copy link

Module

MySQL

Testcontainers version

1.20.3

Using the latest Testcontainers version?

Yes

Host OS

Debian GNU/Linux 12 (bookworm)

Host Arch

AMD64

Docker version

Client: Docker Engine - Community
Version: 27.3.1
API version: 1.47
Go version: go1.22.7
Git commit: ce12230
Built: Fri Sep 20 11:41:11 2024
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 27.3.1
API version: 1.47 (minimum version 1.24)
Go version: go1.22.7
Git commit: 41ca978
Built: Fri Sep 20 11:41:11 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.22
GitCommit: 7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
runc:
Version: 1.1.14
GitCommit: v1.1.14-0-g2c9f560
docker-init:
Version: 0.19.0
GitCommit: de40ad0

What happened?

Using the following (public) minimal reproduction repository: https://codeberg.org/patrickuhlmann/tc_sample

When I run:

git clone https://codeberg.org/patrickuhlmann/tc_sample.git
cd tc_sample/
docker run -it -v "$(pwd)":/src -v /var/run/docker.sock:/var/run/docker.sock -w /src --rm maven:3.9.9-eclipse-temurin-21 mvn verify

The test fails because Test containers cannot startup Ryuk. I am unsure what the problem is because I only encounter it on one of my machines. That machine is running an 12th Gen Intel(R) Core(TM) i3-1220P CPU and Debian GNU/Linux 12 (bookworm).

On another of my machines running ArchLinux with the same docker version and the same steps the issue does not appear.

As far as I know, I did not do any special configuration on the machine that does not work and it used to work (about two months) ago but I cannot say exactly what has changed (system updates, docker version, testcontainers version).

Do you have any idea what causes this different behavior between different machines and/or how to better analyze it?

Relevant log output

15:37:46.620 [main] INFO org.testcontainers.images.PullPolicy -- Image pull policy will be performed by: DefaultPullPolicy()
15:37:46.622 [main] INFO org.testcontainers.utility.ImageNameSubstitutor -- Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
15:37:46.640 [main] INFO org.testcontainers.DockerClientFactory -- Testcontainers version: 1.20.3
15:37:46.893 [main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy -- Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
15:37:46.907 [main] INFO org.testcontainers.DockerClientFactory -- Docker host IP address is 172.17.0.1
15:37:46.917 [main] INFO org.testcontainers.DockerClientFactory -- Connected to docker:
Server Version: 27.3.1
API Version: 1.47
Operating System: Debian GNU/Linux 12 (bookworm)
Total Memory: 63880 MB
15:37:46.983 [main] INFO tc.testcontainers/ryuk:0.9.0 -- Creating container for image: testcontainers/ryuk:0.9.0
15:37:46.988 [main] INFO org.testcontainers.utility.RegistryAuthLocator -- Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:0.9.0, configFile: /root/.docker/config.json, configEnv: DOCKER_AUTH_CONFIG). Falling back to docker-java default behaviour. Exception message: Status 404: No config supplied. Checked in order: /root/.docker/config.json (file not found), DOCKER_AUTH_CONFIG (not set)
15:37:49.173 [main] INFO tc.testcontainers/ryuk:0.9.0 -- Container testcontainers/ryuk:0.9.0 is starting: a188ce9daa665d13756ba90d810d5560304fde003e45164bdfcda42edb7f9286
15:37:50.442 [main] INFO tc.testcontainers/ryuk:0.9.0 -- Container testcontainers/ryuk:0.9.0 started in PT3.458906264S
15:37:55.449 [testcontainers-ryuk] WARN org.testcontainers.utility.RyukResourceReaper -- Can not connect to Ryuk at 172.17.0.1:32809
java.net.SocketTimeoutException: Connect timed out
at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:546)
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:592)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
at java.base/java.net.Socket.connect(Socket.java:751)
at org.testcontainers.utility.RyukResourceReaper.lambda$null$1(RyukResourceReaper.java:105)
at org.rnorth.ducttape.ratelimits.RateLimiter.doWhenReady(RateLimiter.java:27)
at org.testcontainers.utility.RyukResourceReaper.lambda$maybeStart$2(RyukResourceReaper.java:101)
at java.base/java.lang.Thread.run(Thread.java:1583)

Additional Information

No response

@patrickuhlmann
Copy link
Author

It seems the problem appeared when updating the system from Docker 26.0.1 to 27.3.1.

I check the log of the last time that it worked

02:47:55.395 [main] INFO org.testcontainers.DockerClientFactory -- Docker host IP address is 172.17.0.1
02:47:55.410 [main] INFO org.testcontainers.DockerClientFactory -- Connected to docker: 
  Server Version: 26.0.1
  API Version: 1.45
  Operating System: Debian GNU/Linux 12 (bookworm)
  Total Memory: 63880 MB
02:47:55.454 [main] INFO tc.testcontainers/ryuk:0.8.1 -- Creating container for image: testcontainers/ryuk:0.8.1
02:47:55.458 [main] INFO org.testcontainers.utility.RegistryAuthLocator -- Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:0.8.1, configFile: /root/.docker/config.json, configEnv: DOCKER_AUTH_CONFIG). Falling back to docker-java default behaviour. Exception message: Status 404: No config supplied. Checked in order: /root/.docker/config.json (file not found), DOCKER_AUTH_CONFIG (not set)
02:47:58.274 [main] INFO tc.testcontainers/ryuk:0.8.1 -- Container testcontainers/ryuk:0.8.1 is starting: 4f715104753b1568f3993ceedd445e07f407ef3fc6e8f8cbf735bfd4b6063dde
02:47:59.731 [main] INFO tc.testcontainers/ryuk:0.8.1 -- Container testcontainers/ryuk:0.8.1 started in PT4.276939019S
02:47:59.734 [main] INFO org.testcontainers.utility.RyukResourceReaper -- Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
02:47:59.734 [main] INFO org.testcontainers.DockerClientFactory -- Checking the system...
02:47:59.734 [main] INFO org.testcontainers.DockerClientFactory -- ✔︎ Docker server version should be at least 1.6.0

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

No branches or pull requests

1 participant