Unable to connect to Ryuk?

Viewed 1199

Hi I am trying to spin up a test container from my unit test class.

from my test class i am using the following

   @Container
    private static GenericContainer<?> testContainer =  new GenericContainer<>(TEST_IMAGE)
            .withCommand("sleep infinity")
//            .withLogConsumer(LOG_CONSUMER)
            .withNetwork(dockerNetwork).withNetworkAliases(TESTCONTAINER_NETWORK_ALIAS);

however when i run my test i get the error below

SEVERE: Caught exception while closing extension context: org.junit.jupiter.engine.descriptor.ClassExtensionContext@495ee280
java.lang.IllegalStateException: Could not connect to Ryuk at 172.17.0.1:4750
        at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:227)
        at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:219)
        at org.testcontainers.DockerClientFactory$1.getDockerClient(DockerClientFactory.java:101)
        at com.github.dockerjava.api.DockerClientDelegate.authConfig(DockerClientDelegate.java:107)
        at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:316)
        at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.start(TestcontainersExtension.java:242)
        at org.testcontainers.junit.jupiter.TestcontainersExtension$StoreAdapter.access$200(TestcontainersExtension.java:229)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$null$1(TestcontainersExtension.java:59)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$getOrComputeIfAbsent$0(ExtensionValuesStore.java:81)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore$MemoizingSupplier.get(ExtensionValuesStore.java:182)
        at org.junit.jupiter.engine.execution.ExtensionValuesStore.getOrComputeIfAbsent(ExtensionValuesStore.java:84)
        at org.junit.jupiter.engine.execution.NamespaceAwareStore.getOrComputeIfAbsent(NamespaceAwareStore.java:53)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.lambda$beforeAll$2(TestcontainersExtension.java:59)
        at java.util.ArrayList.forEach(ArrayList.java:1259)
        at org.testcontainers.junit.jupiter.TestcontainersExtension.beforeAll(TestcontainersExtension.java:59)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
        at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at java.util.ArrayList.forEach(ArrayList.java:1259)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
        
       

appreciate any help thanks

2 Answers

By accident stumbled accross here: I had the same issue when I was not running the docker engine and the service. Have you docker installed and is the service running?

java.lang.IllegalStateException: Could not connect to Ryuk at

This could due be low disk space as mananged by the (virtual machine) environment that docker runs in. If so, you need to clean up and reclaim some space.

Reclaim disk space:

 docker system prune

If running on Windows you will probably need to reboot.

I use wsl and can confirm that wsl --shutdown was not sufficient, a reboot was required.

Related