testcontainers-java: Timed out waiting for container port to open
#3923 is still reproducible with com.playtika.testcontainers:embedded-keycloak:2.0.8 even after forcibly upgrade org.testcontainers:testcontainers transitive dependency to 1.15.3, getting
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [49187] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:49)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:892)
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:440)
... 104 more
Docker For Windows 3.3.3
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 3
- Comments: 23 (2 by maintainers)
How do you “close” this issue, it keeps happening with random versions of Docker engine and docker desktop.
macbook m1 chip macOS 11.6 docker desktop 4.1.1 docker engine 20.10.8 testcontainers 1.16.0
@schowdiah since the issue is caused by Docker for Windows and not Testcontainers, consider reporting it to the Docker team. We do our best on the Testcontainers side to make things work but some issues (usually related to Docker) are out of our control, unfortunately.
Same issue on Mac M3, Sonoma 14.4, with testcontainer 1.17.2, Colima 0.7.0 for docker and Spring Boot 2.15 + Cucumber. This happens sporadically. Someone pointed out this is not a testcontainer issue but rather a Docker one - so I am looking for a workaround.
Also seeing this exact issue with testcontainers version
1.15.3and Docker Desktop for Mac, version3.3.3. Also believe docker engine20.xto be the cause. Our tests pass on Jenkins build with the older19.03.11docker engine.Running into the same problem. Did anyone else on here find a workaround for this ?
Caused by: org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32802] should be listening) at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:112) at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:52) at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:909) at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:500) ... 34 moreI’m using Rancher Desktop version: 1.12.1 Running on a Mac with an M2 Pro chip, on Sonoma 14.5 testcontainers version: 1.20.1 Docker Version:
Further debugging: I created a simple app to test with and tested in the build agent this keeps failing in (continued to fail), and then a plain docker-in-docker image published by docker, and it succeeded. I then tried creating a fresh clone of the agent container and it worked. Pulling my hair out, I
service docker restartand everything is working again. I had recreated that container multiple times up until that point and it never worked, I still have no idea what was causing the issue.That’s worked for me.
@DJ-Glock can you please try out if it works with the basic example from our reproducer? https://github.com/testcontainers/testcontainers-java-repro
Also, please follow up in issue #4602, this issue has been closed by the original author and had a different cause.
After upgrading to the latest
Docker Desktop 3.4.0(withDocker Engine 20.10.7that contains this fix ) and explicitly setting embedded keycloak db vendor toh2as advised here, I don’t experience this issue anymore. Not sure which one of above changes solved the issue though…