Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker-compose entry container_name not supported #1151

Closed
YNedderhoff opened this issue Jan 16, 2019 · 1 comment · Fixed by #1581
Closed

docker-compose entry container_name not supported #1151

YNedderhoff opened this issue Jan 16, 2019 · 1 comment · Fixed by #1581

Comments

@YNedderhoff
Copy link

I just tried to run a DockerComposeContainer with a docker-compose file that contained container_name entries. Running it just fails like this:

22:33:13.389 [main] INFO  🐳 [alpine/socat:latest] - Creating container for image: alpine/socat:latest
22:33:13.545 [main] ERROR 🐳 [alpine/socat:latest] - Could not start container
org.testcontainers.containers.ContainerLaunchException: Aborting attempt to link to container zhq16mnbjgg6_api_1 as it is not running
    at org.testcontainers.containers.GenericContainer.applyConfiguration(GenericContainer.java:477)
    at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:232)
    at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:216)
    at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:76)
    at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:214)
    at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:203)
    at org.testcontainers.containers.DockerComposeContainer.startAmbassadorContainers(DockerComposeContainer.java:242)
    at org.testcontainers.containers.DockerComposeContainer.start(DockerComposeContainer.java:153)
    at com.brandwatch.integrationtests.testhelpers.DockerComposeEnvironment.start(DockerComposeEnvironment.java:80)
    at com.brandwatch.integrationtests.testhelpers.DockerComposeEnvironment.<init>(DockerComposeEnvironment.java:64)
    at com.brandwatch.integrationtests.testhelpers.DockerComposeEnvironment.<clinit>(DockerComposeEnvironment.java:29)
    at com.brandwatch.integrationtests.SignalControllerIT.<clinit>(SignalControllerIT.java:40)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
    at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runners.Suite.runChild(Suite.java:128)
    at org.junit.runners.Suite.runChild(Suite.java:27)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junitcore.JUnitCore.run(JUnitCore.java:55)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.createRequestAndRun(JUnitCoreWrapper.java:137)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.executeEager(JUnitCoreWrapper.java:107)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:83)
    at org.apache.maven.surefire.junitcore.JUnitCoreWrapper.execute(JUnitCoreWrapper.java:75)
    at org.apache.maven.surefire.junitcore.JUnitCoreProvider.invoke(JUnitCoreProvider.java:159)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:373)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:334)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:119)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:407)

I could imagine that in parts container_name is ignored, in parts it isn't, which leads to the container being referenced to as zhq16mnbjgg6_api_1 in some parts, and as api (the container_name) in other parts. This might lead to this error, although I haven't checked.

This same issue was raised before:
#265 (comment)

It would help if testcontainers would either add proper support for this, or fail fast with a useful error message saying that this field is not supported.

@kiview
Copy link
Member

kiview commented Jan 16, 2019

Thanks a lot for raising the issue.
If throwing an exception could be implemented in a trivial way, I would prefer this as the quick fix, until we get around changing the container name behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants