Skip to content

[Bug]: When COMPOSE_PROJECT_NAME is specified manually, it will cause the container to fail to start #11234

@Mrhs121

Description

@Mrhs121

Module

Core

Testcontainers version

main branch

Using the latest Testcontainers version?

Yes

Host OS

mac

Host Arch

arm

Docker version

Docker version 28.4.0, build d8eb465

What happened?

When COMPOSE_PROJECT_NAME is specified manually, it will cause the container to fail to start.

For example, I don't want to use a random project name, so I specified the project name as seatunnel
Image
Then the following error message will appear

org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container udvzcruigizq_router_1 as it is not running
	at org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:828) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:378) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81) ~[duct-tape-1.0.8.jar:?]
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.testcontainers.containers.DockerComposeContainer.startAmbassadorContainers(DockerComposeContainer.java:359) ~[testcontainers-1.17.6.jar:1.17.6]
	at org.testcontainers.containers.DockerComposeContainer.start(DockerComposeContainer.java:190) ~[testcontainers-1.17.6.jar:1.17.6]

When I configured the COMPOSE_PROJECT_NAME environment variable, the prefix of the generated container name was indeed seatunnel. However, I found that the code did not use the COMPOSE_PROJECT_NAME variable to override the project, which led to the container not being found during detection

Image Image

Relevant log output

Additional Information

No response

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