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

Using DockerComposeContainer with a local image does not work #674

Closed
aruizca opened this issue May 1, 2018 · 7 comments
Closed

Using DockerComposeContainer with a local image does not work #674

aruizca opened this issue May 1, 2018 · 7 comments

Comments

@aruizca
Copy link

aruizca commented May 1, 2018

Hi there,

I am just trying out TestContainers to launch a container with Atlassian Confluence inside which I know it works when using Dokcer for Mac the usual way.

My docker-compose.yml file looks like this:

version: "3"
services:
  confluence:
    image: confluence-4-testing
    volumes:
      - "docker-maven-repo:/root/.m2"
    ports:
      - "1990:1990"
    networks:
      - confluence-test-network
    environment:
      - CONFLUENCE_VERSION

networks:
  confluence-test-network:
    driver: bridge

volumes:
  docker-maven-repo:

please not the image which is a local one and it is not available in any docker hub.

My TestContainer is declared as per the following sentence:

    @Shared
    DockerComposeContainer compose = new DockerComposeContainer(new File("docker-compose.yml"))
            .withEnv("CONFLUENCE_VERSION", "6.8.2")
            .withExposedService("confluence_1",1990)
            .withLocalCompose(true)
            .waitingFor("confluence_1", Wait.forListeningPort())

and the error I am getting is:

org.testcontainers.containers.ContainerLaunchException: Local Docker Compose exited abnormally with code 1 whilst running command: pull

IMO it should not be pulling the image remotely. As I said this work just running docker-compose run --rm --service-ports -e CONFLUENCE_VERSION=6.8.2 confluence

Thanks for your help!

@rnorth
Copy link
Member

rnorth commented May 2, 2018

IMO it should not be pulling the image remotely

I think you're right - we did this originally so that pull failures would be made visible more quickly, but it breaks when you have local-only images.

We should just think about repeatability, though: the tests become dependent upon the local image being present and consistently built beforehand. I'm sure you understand this and have your build process set up to deal with it, but we prefer to at least gently nudge Testcontainers users towards doing things in as repeatable a way as possible.

So: Maybe instead of removing the pull step (which was my first instinct) we could allow it to fail, log a warning, and proceed to do run. The warning message would be something along the lines of docker-compose could not pull all required images - local images will be used instead.

WDYT?

@kiview
Copy link
Member

kiview commented May 2, 2018

Another approach, which follows your argument for having a local image is a pretty conscious decision, would be to add a pull(false) builder flag.

I'm also happy with the warning, but am wondering, if this additional flag make things cleaner (or the API more confusing?).

@bsideup
Copy link
Member

bsideup commented May 2, 2018

Warning sounds good to me 👍

@aruizca
Copy link
Author

aruizca commented May 2, 2018

Warning seems fair enough. IMO this should be transparent for the developer, therefore no need to reflect the possibility of using local images in the API. Better make it and implicit option.

@Cuneytt
Copy link

Cuneytt commented May 24, 2018

started using testcontainers and hit this bug right away, is there a possible ETA on this, thanks

@alexanderkjall
Copy link

Another opinion: I have been working on building some docker images to use in testing of my project, and the extra network traffic from uploading the image and then downloading it again adds significantly to the turn around of my workflow.

@kiview
Copy link
Member

kiview commented Jul 23, 2018

@Cuneytt
I will look into it this week.

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

6 participants