Skip to content

Docker-Compose Wait not being respected #1121

@trajano

Description

@trajano

I have a compose file that has a few services but I am generally interested in the database and the webapp primarily.

    new DockerComposeContainer(new File("compose-ca1.yml"))
        .withLocalCompose(true)
        .withLogConsumer("ca1", outputFrame -> System.out.print(((OutputFrame) outputFrame).getUtf8String()))
        .withExposedService("devdb", 3306, Wait.forHealthcheck().withStartupTimeout(ofMinutes(2)))
        .withExposedService("ca1", 8443, Wait.forListeningPort().withStartupTimeout(ofMinutes(2)));

On a Docker Machine setup in Windows I notice that the timeout is not being respected, its not even two minutes and the test fails given something like

org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container juedehkaec9f_devdb_1 as it is not running
at org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:477)

I started traversing through some old bugs and I noticed this https://github.com/testcontainers/testcontainers-java/pull/514/files#r245190284 it may be assuming that we are using the sockets which is not something I am doing on a Docker Machine setup.

Also looking at the code for DockerComposeContainer#start it goes like this

        createServices();
        startAmbassadorContainers();
        waitUntilServiceStarted();

The stack trace noted that it failed on startAmbassadorContainers() which is for socat. However, I think there should be a check to make sure the services are up because my database takes a bit of time to start up I think the socat creation may be failing there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions