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

Problem with docker-compose #484

Closed
kronar opened this issue Nov 10, 2017 · 10 comments
Closed

Problem with docker-compose #484

kronar opened this issue Nov 10, 2017 · 10 comments

Comments

@kronar
Copy link

kronar commented Nov 10, 2017

Tried to write some integration test with TestContainers, I faced following issue

    @ClassRule
            public static DockerComposeContainer environment =
                new DockerComposeContainer(new File("src/test/resources/docker-compose.yml"))
                    .withLocalCompose(true);

Produces the following output

15:29:58.578 [main] INFO 🐳 [docker-compose] - Local Docker Compose is running command: pull
15:29:58.628 [main] DEBUG org.zeroturnaround.exec.ProcessExecutor - Executing [docker-compose, pull] in /Users/Projects/someProject/src/test/resources with environment {COMPOSE_PROJECT_NAME=byrvc2, COMPOSE_FILE=/Users/Projects/someProject/src/test/resources/docker-compose.yml}.
15:29:58.638 [main] DEBUG org.zeroturnaround.exec.ProcessExecutor - Started java.lang.UNIXProcess@1bae316d
15:29:59.212 [Thread-2] ERROR 🐳 [docker-compose] - Pulling mongodb (mongo:latest)...
15:30:01.185 [Thread-1] INFO 🐳 [docker-compose] - latest: Pulling from library/mongo
15:30:01.779 [Thread-1] INFO 🐳 [docker-compose] - Digest: sha256:2c55bcc870c269771aeade05fc3dd3657800540e0a48755876a1dc70db1e76d9
15:30:01.779 [Thread-1] INFO 🐳 [docker-compose] - Status: Image is up to date for mongo:latest
15:30:01.780 [Thread-2] ERROR 🐳 [docker-compose] - Pulling mnemonic (tag/project:latest)...
15:30:03.445 [Thread-2] ERROR 🐳 [docker-compose] - pull access denied for tag/project, repository does not exist or may require 'docker login'
15:30:03.472 [main] DEBUG org.zeroturnaround.exec.WaitForProcess - java.lang.UNIXProcess@1bae316d stopped with exit code 1
15:30:03.475 [main] INFO 🐳 [docker-compose] - Local Docker Compose is running command: down -v
15:30:03.475 [main] DEBUG org.zeroturnaround.exec.ProcessExecutor - Executing [docker-compose, down, -v] in

It seems that it is not direct issue of TestContainers but looks similar to docker/compose#3660.
I've verified this on my machine and execution of docker-compose pull also fails because of docker login was never executed.

Also, possibly some workaround required to be implemented.

Additional info:

OS: Mac OS 10.12.6
$ docker -v
Docker version 17.09.0-ce, build afdb6d4

$ docker-compose -v
docker-compose version 1.16.1, build 6d1ac21

$ docker-machine -v
docker-machine version 0.12.2, build 9371605

TestContainers v 1.4.3

@kiview
Copy link
Member

kiview commented Nov 15, 2017

Hi @kronar, which credentials-store do you use in your Docker for Mac installation?

Might be related to #483.

@kronar
Copy link
Author

kronar commented Nov 15, 2017

Hi, @kiview
I've just installed docker for mac and didn't logged in. So credentials-store was not used.
Even if it's used i think it is default for Docker for Mac.
Can i provide you any additional info ? how can i define which credential-store is used by docker ob my machine ?

@kronar
Copy link
Author

kronar commented Nov 15, 2017

@kiview also i've looked to issue #483. I'm pulling public images from public docker repo. No secrets at all

@kiview
Copy link
Member

kiview commented Nov 15, 2017

I thought the problem resides at this point:

15:30:01.780 [Thread-2] ERROR 🐳 [docker-compose] - Pulling mnemonic (tag/project:latest)...
15:30:03.445 [Thread-2] ERROR 🐳 [docker-compose] - pull access denied for tag/project, repository does not exist or may require 'docker login'
15:30:03.472 [main] DEBUG org.zeroturnaround.exec.WaitForProcess - java.lang.UNIXProcess@1bae316d stopped with exit code 1

Could you provide the docker-compose.yml file? Does it work if you use docker-compose up directly?

@bsideup
Copy link
Member

bsideup commented Nov 15, 2017

@kiview the issue is already having enough info :) docker-compose pull doesn't work with local images:
docker/compose#3660

We might handle it in TC by ignoring the error from docker-compose pull until it's fixed in Docker Compose

@stale
Copy link

stale bot commented Oct 28, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe this is a mistake, please reply to this comment to keep it open. If there isn't one already, a PR to fix or at least reproduce the problem in a test case will always help us get back on track to tackle this.

@stale stale bot added the stale label Oct 28, 2018
@stale
Copy link

stale bot commented Nov 11, 2018

This issue has been automatically closed due to inactivity. We apologise if this is still an active problem for you, and would ask you to re-open the issue if this is the case.

@stale stale bot closed this as completed Nov 11, 2018
@berardino
Copy link

berardino commented Dec 10, 2018

I am seeing this issue. I have a docker-compose with two services:

  • myservice (only available on local)
  • postgres

When running the test using:

  override val container = DockerComposeContainer(
    new File(getClass.getResource("/docker-compose.yml").toURI),
    exposedServices = Seq(ExposedService("myservice", 8080)))

the postgres image is correctly pulled from the registry, but docker-compose fails
to see the myservice image available locally and it fails to pull it from docker registry.

Note that if I run docker-compose up from my shell everything works just fine.

1:04:37.962 [Thread-1] ERROR 🐳 [docker-compose] - ERROR: for myservice pull access denied for myservice-local-images, repository does not exist or may require 'docker login'
11:04:37.963 [Thread-1] ERROR 🐳 [docker-compose] - pull access denied for my-local-images, repository does not exist or may require 'docker login'
11:04:38.021 [ScalaTest-run] WARN o.t.c.DockerComposeContainer - Exception while pulling images, using local images if available
org.testcontainers.containers.ContainerLaunchException: Local Docker Compose exited abnormally with code 1 whilst running command: pull
at org.testcontainers.containers.LocalDockerCompose.invoke(DockerComposeContainer.java:656)
at org.testcontainers.containers.DockerComposeContainer.runWithCompose(DockerComposeContainer.java:216)
at org.testcontainers.containers.DockerComposeContainer.pullImages(DockerComposeContainer.java:164)
at org.testcontainers.containers.DockerComposeContainer.start(DockerComposeContainer.java:151)
at org.testcontainers.containers.DockerComposeContainer.starting(DockerComposeContainer.java:122)
at org.testcontainers.containers.TestContainerAccessor$.starting(TestContainerAccessor.scala:13)
at com.dimafeng.testcontainers.TestContainerProxy.starting(TestContainer.scala:106)
at com.dimafeng.testcontainers.TestContainerProxy.starting$(TestContainer.scala:106)
at com.dimafeng.testcontainers.DockerComposeContainer.starting(DockerComposeContainer.scala:67)
at com.dimafeng.testcontainers.ForAllTestContainer.run(TestContainer.scala:67)
at com.dimafeng.testcontainers.ForAllTestContainer.run$(TestContainer.scala:63)
at MyServiceSpec.run(MyServiceSpec.scala:6)
at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:45)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13(Runner.scala:1346)
at org.scalatest.tools.Runner$.$anonfun$doRunRunRunDaDoRunRun$13$adapted(Runner.scala:1340)
at scala.collection.immutable.List.foreach(List.scala:388)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1340)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24(Runner.scala:1031)
at org.scalatest.tools.Runner$.$anonfun$runOptionallyWithPassFailReporter$24$adapted(Runner.scala:1010)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1506)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1010)
at org.scalatest.tools.Runner$.run(Runner.scala:850)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.runScalaTest2(ScalaTestRunner.java:131)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTestRunner.main(ScalaTestRunner.java:28)
11:04:38.022 [ScalaTest-run] INFO 🐳 [docker-compose] - Local Docker Compose is running command: up -d
11:04:38.388 [Thread-3] ERROR 🐳 [docker-compose] - Creating network "7h9sn6cohrbc_default" with the default driver
11:04:38.479 [Thread-3] ERROR 🐳 [docker-compose] - Creating 7h9sn6cohrbc_mydb_1_d2be9423f372 ...
1

@kalexmills
Copy link

kalexmills commented Feb 22, 2019

This is related.
docker/compose#3660

Seems that older versions of docker-compose pull does not respect local images unless you include a flag.

@kiview
Copy link
Member

kiview commented Feb 24, 2019

@berardino Try to use withLocalCompose(true).

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

No branches or pull requests

5 participants