-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Hi,
I am trying to run DockerComposeContainer from a JUnit test, but it doesn't work. The application itself seems fine, as I can run it with no problem from command line:
docker-compose up
I set up DockerComposeContainer in my test with (in Kotlin):
companion object {
class KDockerComposeContainer(path: File) : DockerComposeContainer<KDockerComposeContainer>(path)
@ClassRule @JvmField
val env = KDockerComposeContainer(File("../docker-compose.yml"))
}
The test fails at initialization, with the following stack trace that does not really say much about what is wrong:
Connected to the target VM, address: '127.0.0.1:53858', transport: 'socket'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ℹ︎ Checking the system...
✔ Docker version is newer than 1.6.0
✔ Docker environment has more than 2GB free
✔ File should be mountable
✔ Exposed port is accessible
Test ignored.
org.testcontainers.containers.ContainerLaunchException: Container startup failed
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:189)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(DockerComposeContainer.java:431)
at org.testcontainers.containers.DockerComposeContainer.runWithCompose(DockerComposeContainer.java:151)
at org.testcontainers.containers.DockerComposeContainer.pullImages(DockerComposeContainer.java:121)
at org.testcontainers.containers.DockerComposeContainer.starting(DockerComposeContainer.java:108)
at org.testcontainers.containers.FailureDetectingExternalResource$1.evaluate(FailureDetectingExternalResource.java:29)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:83)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:182)
... 12 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:256)
at org.testcontainers.containers.GenericContainer.lambda$start$0(GenericContainer.java:184)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
... 13 more
Caused by: java.lang.IllegalStateException: Container did not start correctly.
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:231)
... 15 more
By using a debugger, I can see it fails to start docker/compose:1.8.0. Note: I am using Windows 10, with Docker version 17.06.0-ce-win18 (12627), and TestContainers 1.4.2. TestContainers work fines in the other tests in which I have single Docker images (i.e., no Compose).
Is this a bug, or am I missing something? (In this latter case, more info in the thrown exceptions would be useful)