Hi,
when starting a Container we get the following exception:
10:23:40,784 [7592:main] INFO d.i.com:5000/product/service:latest] - Creating container for image: online.com:5000/product/service:latest
10:23:40,927 [7592:main] INFO d.i.com:5000/product/service:latest] - Starting container with ID: a10d53b52a463ea9c080618f6a770ac712966b9826b4701b1d0e3073b52dbeb9
10:23:41,490 [7592:main] INFO d.i.com:5000/product/service:latest] - Container online.com:5000/product/service:latest is starting: a10d53b52a463ea9c080618f6a770ac712966b9826b4701b1d0e3073b52dbeb9
10:24:41,514 [7592:main] ERROR d.i.com:5000/product/service:latest] - Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32781] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:47) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.wait.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:23) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:582) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:259) ~[testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:212) ~[testcontainers-1.11.2.jar:?]
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76) [duct-tape-1.0.7.jar:?]
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:210) [testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:199) [testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.GenericContainer.starting(GenericContainer.java:714) [testcontainers-1.11.2.jar:?]
at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29) [testcontainers-1.11.2.jar:?]
at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) [junit-4.12.jar:4.12]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) [.cp/:?]
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) [.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) [.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) [.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) [.cp/:?]
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206) [.cp/:?]
We read a lot of threads containing this issue but we are not able to solve it :/
Do you have an idea what we can do to solve this issue?
Thank you
Hi @HeadHunter90,
Did you get more logs? Usually, when container fails to start, we print the logs of it.
You may get the following exception because your app failed to start and it is not Testcontainers related issue.
Thank you for your quick response,
Can i send you the full stacktrace in a PM?
It contains private information. Maybe you can tell me how to send a PM? I am new on Github :)
Thank you
@HeadHunter90 you can join our Slack and send me a DM there :)
The solution was to add
.waitingFor(Wait.forHttp("/readiness").forPort(8000));
because we have liveness and readyness checks.
Thanks a lot @bsideup
Most helpful comment
The solution was to add
.waitingFor(Wait.forHttp("/readiness").forPort(8000));
because we have liveness and readyness checks.
Thanks a lot @bsideup