-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed as not planned
Description
When reusing a container together with Testcontainers#exposeHostPorts the second container startup fails with an exception.
Example (using testconatienrs 1.15.0):
package com.example;
import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
@Testcontainers
public class MyTest {
@Test
void test() {
org.testcontainers.Testcontainers.exposeHostPorts(8000);
final GenericContainer container = new GenericContainer<>("alpine").withReuse(true).withCommand("top");
container.start();
final GenericContainer container2 = new GenericContainer<>("alpine").withReuse(true).withCommand("top");
container2.start();
}
}
Result:
org.testcontainers.containers.ContainerLaunchException: Container startup failed
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
Caused by: com.github.dockerjava.api.exception.DockerException: Status 403: {"message":"endpoint with name objective_benz already exists in network bridge"}
Expected Result:
- no exception is thrown
- Host is reachable from inside the container under
host.testcontainers.internal:8000
nburkley
Metadata
Metadata
Assignees
Labels
No labels