You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
+1
when you have withReuse turned on, and new container gets started on retry - TC still waits for the previous port, despite new container started on a new one.
When reusing a container together with Testcontainers#exposeHostPorts the second container startup fails with an exception.
Example (using testconatienrs 1.15.0):
Result:
Expected Result:
host.testcontainers.internal:8000
The text was updated successfully, but these errors were encountered: