When using regular containers, the image name is usually sufficient for identifying which container given log line is about.
However, when using 2+ GenericContainer instances with same image, it's no longer so:
2020-01-13T13:32:45.298+0100 INFO testcontainers-lifecycle-2 🐳 [centos:7] Creating container for image: centos:7
2020-01-13T13:32:45.297+0100 INFO testcontainers-lifecycle-1 🐳 [centos:7] Creating container for image: centos:7
2020-01-13T13:32:45.297+0100 INFO testcontainers-lifecycle-0 🐳 [centos:7] Creating container for image: centos:7
...
2020-01-13T13:37:46.946+0100 ERROR testcontainers-lifecycle-1 🐳 [centos:7] Could not start container
java.lang.IllegalStateException: Container exited with code 1
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:457)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:317)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:315)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:302)
at java.util.concurrent.CompletableFuture.uniRun(CompletableFuture.java:705)
at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:687)
at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:442)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Neither the log line, nor the exception provide information which container failed.
When using regular containers, the image name is usually sufficient for identifying which container given log line is about.
However, when using 2+
GenericContainerinstances with same image, it's no longer so:Neither the log line, nor the exception provide information which container failed.