使用测试容器时如何解决"Can't get Docker image"?
How to solve "Can't get Docker image" when using test containers?
我正在使用测试容器,直到现在它都可以正常工作。我最近更新了 docker 和 IntelliJ,但我不知道这是否是以下问题的原因。
这是我使用的依赖项:
testCompile 'org.testcontainers:testcontainers:1.12.3'
testCompile 'org.testcontainers:oracle-xe:1.12.3'
这是堆栈跟踪:
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(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
有谁知道如何解决这个问题?
提前致谢。
问题是由新的 docker 版本引起的。如果您将 docker 更新为 2.4.0,那么您可以尝试几个选项。
- 在 docker 首选项中关闭“使用 gRPC FUSE 进行文件共享”选项。
- 将测试容器更新为 1.15.0-rc2
- 将 docker 降级为 2。3.x
我尝试了第一个选项,它对我有用。
我用的是mac。不知道其他平台有没有类似的问题
我正在使用测试容器,直到现在它都可以正常工作。我最近更新了 docker 和 IntelliJ,但我不知道这是否是以下问题的原因。
这是我使用的依赖项:
testCompile 'org.testcontainers:testcontainers:1.12.3'
testCompile 'org.testcontainers:oracle-xe:1.12.3'
这是堆栈跟踪:
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(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
有谁知道如何解决这个问题?
提前致谢。
问题是由新的 docker 版本引起的。如果您将 docker 更新为 2.4.0,那么您可以尝试几个选项。
- 在 docker 首选项中关闭“使用 gRPC FUSE 进行文件共享”选项。
- 将测试容器更新为 1.15.0-rc2
- 将 docker 降级为 2。3.x
我尝试了第一个选项,它对我有用。
我用的是mac。不知道其他平台有没有类似的问题