testcontainers-hs icon indicating copy to clipboard operation
testcontainers-hs copied to clipboard

Ryuk is inaccessible when tests are run inside a network

Open michivi opened this issue 1 year ago • 0 comments

The Ryuk container is inaccessible by testcontainers-hs when it is run inside a Docker container, itself running in a network different from the default one.

The tested scenario is:

  • The testing code is run inside a container, in a dedicated network
  • The testing code spawns a testcontainer with a dedicated network (different from the previous one, but the issue also occurs within the same network). As a result, a Ryuk container is spawned for it. But it is so in the default Docker network.
  • When attempting to contact Ryuk, testcontainers cannot find the dedicated alias, and fails.

This scenario can be encountered when running tests on GitHub Actions within a container.

In such a scenario, the following message is printed:

       uncaught exception: DockerException
       InspectOutputMissingNetwork {id = "cb9daeaca3[...]37bd2490"}

Whenever testcontainers-hs is run inside a container in a network different from the default one, then Ryuk cannot be accessed directly. It needs to access Ryuk using the mapped port on the host.

  • Tested version: 0.5.0.0
  • Environment: GitHub Actions, code running inside a Docker container

michivi avatar Jun 22 '23 13:06 michivi