Running inside another container
'Docker wormhole' pattern - Sibling Docker containers
Docker-only example
If you choose to run your tests in a Docker Wormhole configuration, which involves using sibling containers, it is necessary to mount Docker's raw socket /var/run/docker.sock.raw
. You find more information and an explanation of the Docker bug in this comment.
1 |
|
Note
If you are using Docker Desktop, you need to configure the TESTCONTAINERS_HOST_OVERRIDE
environment variable to use the special DNS name
host.docker.internal
for accessing the host from within a container, which is provided by Docker Desktop:
-e TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal
Docker Compose example
A minimal docker-compose.yml
file that builds a new container image and runs the test inside the container look something like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|