Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

IllegalStateException: Can not connect to Ryuk #14

Closed
vorburger opened this issue Apr 4, 2019 · 4 comments
Closed

IllegalStateException: Can not connect to Ryuk #14

vorburger opened this issue Apr 4, 2019 · 4 comments

Comments

@vorburger
Copy link
Owner

This project used to build fine, but when I retried (locally) today, it fails like so:

[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ launcher ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.opendaylight.etcd.launcher.test.EtcdLauncherTest
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 45.8 s <<< FAILURE! - in org.opendaylight.etcd.launcher.test.EtcdLauncherTest
[ERROR] testEtcd(org.opendaylight.etcd.launcher.test.EtcdLauncherTest)  Time elapsed: 41.274 s  <<< ERROR!
java.lang.IllegalStateException: Can not connect to Ryuk
	at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:148)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:125)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:138)
	at org.testcontainers.containers.FixedHostPortGenericContainer.<init>(FixedHostPortGenericContainer.java:16)
	at io.etcd.jetcd.launcher.EtcdContainer.<init>(EtcdContainer.java:80)
@vorburger
Copy link
Owner Author

The opendaylight-etcd/launcher/target/surefire-reports/org.opendaylight.etcd.launcher.test.EtcdLauncherTest-output.txt as-is is not particularly useful:

[main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Loaded org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy from ~/.testcontainers.properties, will try it first
[main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Will use 'okhttp' transport
[main] INFO org.testcontainers.dockerclient.EnvironmentAndSystemPropertyClientProviderStrategy - Found docker client settings from environment
[main] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Found Docker environment with Environment variables, system properties and defaults. Resolved: 
    dockerHost=unix:///var/run/docker.sock
    apiVersion='{UNKNOWN_VERSION}'
    registryUrl='https://index.docker.io/v1/'
    registryUsername='vorburger'
    registryPassword='null'
    registryEmail='null'
    dockerConfig='DefaultDockerClientConfig[dockerHost=unix:///var/run/docker.sock,registryUsername=vorburger,registryPassword=<null>,registryEmail=<null>,registryUrl=https://index.docker.io/v1/,dockerConfigPath=/home/vorburger/.docker,sslConfig=<null>,apiVersion={UNKNOWN_VERSION},dockerConfig=<null>]'

[main] INFO org.testcontainers.DockerClientFactory - Docker host IP address is localhost
[main] INFO org.testcontainers.DockerClientFactory - Connected to docker: 
  Server Version: 1.13.1
  API Version: 1.26
  Operating System: Fedora 29 (Workstation Edition)
  Total Memory: 19476 MB
[testcontainers-ryuk] WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at localhost:32778
java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at java.net.Socket.connect(Socket.java:538)
        at java.net.Socket.<init>(Socket.java:434)
        at java.net.Socket.<init>(Socket.java:211)
        at org.testcontainers.utility.ResourceReaper.lambda$start$1(ResourceReaper.java:112)
        at java.lang.Thread.run(Thread.java:748)

but this is probably of interest & related:

$ systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-03-27 20:07:31 CET; 1 weeks 0 days ago
     Docs: http://docs.docker.com
 Main PID: 1336 (dockerd-current)
    Tasks: 19 (limit: 8192)
   Memory: 310.0M
   CGroup: /system.slice/docker.service
           └─1336 /usr/bin/dockerd-current --add-runtime oci=/usr/libexec/docker/docker-runc-current --default-runtime=oci --authorization-plugin>

Apr 04 12:25:40 khany dockerd-current[1336]: time="2019-04-04T12:25:40.006299612+02:00" level=warning msg="bb8dd354bc44de4dd8a8ea73373da94f8541f8>
Apr 04 12:27:03 khany dockerd-current[1336]: time="2019-04-04T12:27:03.278689640+02:00" level=warning msg="failed to retrieve docker-runc version>
Apr 04 12:27:03 khany dockerd-current[1336]: time="2019-04-04T12:27:03.279152622+02:00" level=warning msg="failed to retrieve docker-init version>
Apr 04 12:27:04 khany dockerd-current[1336]: 2019/04/04 10:27:04 Starting on port 8080...
Apr 04 12:27:04 khany dockerd-current[1336]: panic: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/>
Apr 04 12:27:04 khany dockerd-current[1336]: 
Apr 04 12:27:04 khany dockerd-current[1336]: goroutine 1 [running]:
Apr 04 12:27:04 khany dockerd-current[1336]: main.main()
Apr 04 12:27:04 khany dockerd-current[1336]:         /go/src/github.com/testcontainers/moby-ryuk/main.go:31 +0xe2e
Apr 04 12:27:04 khany dockerd-current[1336]: time="2019-04-04T12:27:04.452543464+02:00" level=warning msg="b1a29a551b79fb1cada802cfe0543a4daba9db>

@vorburger
Copy link
Owner Author

Hm, so if I Disable Ryuk by setting TESTCONTAINERS_RYUK_DISABLED environment variable to true, then this project builds fine:

TESTCONTAINERS_RYUK_DISABLED=true mvn clean install

@vorburger
Copy link
Owner Author

vorburger commented Apr 4, 2019

if I Disable Ryuk by setting TESTCONTAINERS_RYUK_DISABLED environment variable to true, then then this project builds fine: TESTCONTAINERS_RYUK_DISABLED=true mvn clean install

except that only works for the launcher but not for the jetcd-launcher-maven-plugin used in features/odl-mdsal-broker ... even adding export TESTCONTAINERS_RYUK_DISABLED=true e.g. to ~/.zshrc does not help - looks like Maven plugins don't inherit environment variables? 😭

@vorburger
Copy link
Owner Author

Installing Docker.com CE via https://docs.docker.com/install/linux/docker-ce/fedora/, instead of (and thus first uninstalling) Fedora's Docker, works around this problem and makes Testcontainers just work out of the box.

Closing this issue for this project. May be testcontainers/testcontainers-java#1356 will fix it later.

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

No branches or pull requests

1 participant