You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I am having the following issue using testcontainers within another docker container.
Steps to reproduce
Run a ubuntu docker container using latest tag with docker socket from the host machine mounted. I have also found this on Amazon Linux's container.
Add any dependencies you need to the image, git, maven etc
Using Testcontainers version 1.16.2 create a docker compose container like this:
@container
public static DockerComposeContainer environment =
new DockerComposeContainer(new File("src/test/resources/docker-compose.yml"))
.withExposedService(ClientTestHelper.SERVICE_NAME, ClientTestHelper.PORT)
.withExposedService(lientTestHelper.LOCALSTACK_SERVICE_NAME, DigClientTestHelper.LOCALSTACK_PORT)
.withLogConsumer(ClientTestHelper.SERVICE_NAME, SLF4J_LOG_CONSUMER)
.withLogConsumer(ClientTestHelper.LOCALSTACK_SERVICE_NAME, SLF4J_LOG_CONSUMER)
.withLocalCompose(true);
(I have tried with local compose set to false too)
Running a mvn goal that runs the tests, I get the following error:
WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at 172.17.0.1:56047 java.net.ConnectException: Connection refused (Connection refused)
If I disable Ryuk I get errors stating that the port in use by a container is already bound. When I run a docker ps I can see the containers are already running. So it feels like there is lack of awareness between test containers and the docker sub system.
Once I am at the stage above with the Ryuk issue, I can run docker ps and see the container is running and the logs look ok. I can telnet etc the port Ryuk exposes and connectivity is there.
Also if I run docker-compose up against the docker compose file that the test uses everything works as expected. If I run the maven target on my local machine (Mac) it works ok. I have to run this in a container because of the CI in use.
Is there something I have missed or have I found a bug?
The text was updated successfully, but these errors were encountered:
Have the same problem. It seems Testcontainers do not resolve hostname properly. It should be host.docker.internal:56047 address.
I had same issue in MacOS (Docker Desktop 4.4.2 (73305), TestContainers 1.16.2). I tried setting environment variable TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal and it worked. Hope this helps!
@avst-dmartino sorry for not answering earlier, you are likely running into #4395. Please use the workaround from #4395 (comment) that was suggested to us by upstream Docker.
I'll close this issue as duplicate, please let us know if the issue persists.
Have the same problem. It seems Testcontainers do not resolve hostname properly. It should be host.docker.internal:56047 address.
I had same issue in MacOS (Docker Desktop 4.4.2 (73305), TestContainers 1.16.2). I tried setting environment variable TESTCONTAINERS_HOST_OVERRIDE=host.docker.internal and it worked. Hope this helps!
So I am having the following issue using testcontainers within another docker container.
Steps to reproduce
Run a ubuntu docker container using latest tag with docker socket from the host machine mounted. I have also found this on Amazon Linux's container.
Add any dependencies you need to the image, git, maven etc
Using Testcontainers version 1.16.2 create a docker compose container like this:
@container
public static DockerComposeContainer environment =
new DockerComposeContainer(new File("src/test/resources/docker-compose.yml"))
.withExposedService(ClientTestHelper.SERVICE_NAME, ClientTestHelper.PORT)
.withExposedService(lientTestHelper.LOCALSTACK_SERVICE_NAME, DigClientTestHelper.LOCALSTACK_PORT)
.withLogConsumer(ClientTestHelper.SERVICE_NAME, SLF4J_LOG_CONSUMER)
.withLogConsumer(ClientTestHelper.LOCALSTACK_SERVICE_NAME, SLF4J_LOG_CONSUMER)
.withLocalCompose(true);
(I have tried with local compose set to false too)
Running a mvn goal that runs the tests, I get the following error:
WARN org.testcontainers.utility.ResourceReaper - Can not connect to Ryuk at 172.17.0.1:56047 java.net.ConnectException: Connection refused (Connection refused)
If I disable Ryuk I get errors stating that the port in use by a container is already bound. When I run a docker ps I can see the containers are already running. So it feels like there is lack of awareness between test containers and the docker sub system.
Once I am at the stage above with the Ryuk issue, I can run docker ps and see the container is running and the logs look ok. I can telnet etc the port Ryuk exposes and connectivity is there.
Also if I run docker-compose up against the docker compose file that the test uses everything works as expected. If I run the maven target on my local machine (Mac) it works ok. I have to run this in a container because of the CI in use.
Is there something I have missed or have I found a bug?
The text was updated successfully, but these errors were encountered: