Skip to content

DockerComposeContainer inconsistently appends "_1" to service/image names #149

@ldcasillas-progreso

Description

@ldcasillas-progreso

This code doesn't work, for reasons that strike me as a bug:

    public static final String RABBITMQ_SERVICE = "rabbitmq";
    public static final int RABBITMQ_PORT = 5672;

    public static DockerComposeContainer environment() {
        return new DockerComposeContainer(new File("docker-compose.yml"))
                .withExposedService(RABBITMQ_SERVICE, RABBITMQ_PORT);
    }

The problem seems to be that some piece of code is appending the string "_1" to the value of RABBITMQ_SERVICE, but it's not being done consistently in all contexts where it's required. So when the test starts it logs this:

[pool-3-thread-1] INFO 🐳 [dduportal/docker-compose:1.6.0] - STDERR: Creating 5ripbx_rabbitmq_1

But then later it errors this way (over and over, like in #147 ):

[pool-1-thread-1] ERROR 🐳 [richnorth/ambassador:latest] - Could not start container
org.testcontainers.shaded.com.github.dockerjava.api.InternalServerErrorException: Could not get container for 5ripbx_rabbitmq

The error goes away (i.e., I get #146 instead) when I make this code change:

    public static final String RABBITMQ_SERVICE = "rabbitmq_1";

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions