4

I am using test containers and it used to work fine until now. I recently updated docker and IntelliJ, but I do not know if this is the cause of the following issue.

This are the dependencies I used:

testCompile 'org.testcontainers:testcontainers:1.12.3' testCompile 'org.testcontainers:oracle-xe:1.12.3' 

This is the stacktrace:

2020-10-12T13:13:06.709 WARN testcontainers-ryuk [rg.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:114) at java.lang.Thread.run(Thread.java:748) java.lang.ExceptionInInitializerError at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) ... Caused by: org.testcontainers.containers.ContainerFetchException: Can't get Docker image: RemoteDockerImage(imageName=ryangoh/oracle_12c_r1_xe:latest) at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1153) at org.testcontainers.containers.GenericContainer.setDockerImageName(GenericContainer.java:1141) at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:246) at org.testcontainers.containers.JdbcDatabaseContainer.<init>(JdbcDatabaseContainer.java:36) at org.testcontainers.containers.OracleContainer.<init>(OracleContainer.java:40) at com.vocalink.bps.reporting.integration.AbstractContainerTest.<clinit>(AbstractContainerTest.java:24) ... 49 more Caused by: java.lang.IllegalStateException: Can not connect to Ryuk at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:150) at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:131) at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:51) at org.testcontainers.images.RemoteDockerImage.resolve(RemoteDockerImage.java:27) at org.testcontainers.utility.LazyFuture.getResolvedValue(LazyFuture.java:20) at org.testcontainers.utility.LazyFuture.get(LazyFuture.java:27) at org.testcontainers.containers.GenericContainer.getDockerImageName(GenericContainer.java:1151) ... 54 more 

Does anyone know how to solve this issue?

Thank you in advance.

2
  • Can you add the result of docker ps and docker images command in the question? Commented Oct 12, 2020 at 14:48
  • @wak786 I found the answer. Looks like there is a problem in docker 2.4.0 for mac Commented Oct 12, 2020 at 15:03

2 Answers 2

9

The issue was caused by the new docker version. In case you updated docker to 2.4.0 then there are a few options you can try.

  1. switch the "Use gRPC FUSE for file sharing" option off in docker preferences.
  2. update the testcontainers to 1.15.0-rc2
  3. downgrade docker to 2.3.x

I tried the first option and it worked for me.

I use a mac. I do not know if there is a similar issue on other platforms.

Sign up to request clarification or add additional context in comments.

2 Comments

@Andrey it worked for me too, but I have the impression it runs slower. Do you experience such issues?
Just FYI - in newer docker version for mac, switch from "gRPC FUSE" to "osxfs (Legacy)" to fix that issue.
0

I had the same issue on Mac OS X with testcontainers for Java and Colima. This solved it for me:

sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock 

Ref: https://java.testcontainers.org/supported_docker_environment/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.