question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Timed out waiting for container port to open

See original GitHub issue

#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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
memekascommented, Oct 24, 2021
import org.testcontainers.containers.GenericContainer
import org.testcontainers.utility.DockerImageName

open class KGenericContainer(image: String) : GenericContainer<KGenericContainer>(DockerImageName.parse(image))

fun main() {
    val container = KGenericContainer("MY_CONTAINER")
        .withExposedPorts(8081)
    container.start()
}
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [62362] 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:923)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:466)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:329)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:327)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:315)

macbook m1 chip macOS 11.6 docker desktop 4.1.1 docker engine 20.10.8 testcontainers 1.16.0

3reactions
schowdiahcommented, Sep 23, 2021

How do you “close” this issue, it keeps happening with random versions of Docker engine and docker desktop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timed out waiting for container port to open (localhost ports
It seems that you do not have docker running. Try sudo systemctl status docker to check if the daemon is running and if...
Read more >
Waiting for containers to start or be ready - Testcontainers
Ordinarily Testcontainers will wait for up to 60 seconds for the container's first mapped network port to start listening. This simple measure provides...
Read more >
Testcontainers timed out waiting for container port to open ...
Coding example for the question Testcontainers timed out waiting for container port to open, with Elasticsearch docker image-docker.
Read more >
org.testcontainers.containers.ContainerLaunchException java ...
throw new ContainerLaunchException(String.format( "Timed out waiting for URL ... new ContainerLaunchException("Timed out waiting for container port to open ...
Read more >
org.testcontainers.containers.ContainerLaunchException
Failsafe will propagate this only when timeout reached. throw new ContainerLaunchException(format( "Timed out waiting for container port to open (%s ports: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found