Docker-compose inside a docker container on a remote circleci docker container?


In CircleCI 1.0, I have a selenium test suite that does a docker-compose up -d && start_web_app as a before filter for the test prep steps, and a stop_web_app && docker-compose down as an after filter for our test teardown step, and the container ports are mapped to local ports.

In CircleCI 2.0, this does not work since the docker containers are in a remote environment. I’m going to try to think of a solution, but is there any suggestion on how to migrate this test setup to be compatible with the 2.0 setup without going the machine executor route?


You can just install docker-compose in the image you run for the job (or rather, have a pre-built image with docker-compose). It still works with the remote Docker host environment.

I’m guessing mapping the ports is the issue holding you back. Perhaps you could move the test commands to another container that is setup in the same docker-compose.yml.


I could and I was starting to do that, but I can’t seem to get it to work and gave up… I’m curious how other people are doing this


I imagine using docker containers for DB, and running the web app on primary container would be a very common use-case/scenario


Just list those DB containers in the top of your config. Is there a reason why that doesn’t work for you?

You can’t connect directly to those remote DB containers, so running all the containers on the machine would be more ideal if it’s required.


The reason why listing the DB containers at the top of the config doesn’t work is because I need to build a custom ElasticSearch image, which is not supported. Not only that, but we use docker-compose in our development, and it’s not a good idea to maintain both a circleci config and a docker-compose config, ideally we want test/dev environment parity which is the appeal of docker.

I was going to experiment with machine executor, but I read that is part of some higher tier plan? We make use of Docker heavily so would be great if we have greater flexibility in leveraging Docker on circleci.


It’s likely going to be a “premium feature” but I don’t yet know what that actually means for your billing.


Could we get more specifications for what the VM looks like for the machine executor?
I can’t seem to find them for CircleCI 2.0 docs. I’m mainly interested what versions of Docker/Docker-compose it is packaged with and the version of Ubuntu/Linux.

Hopefully unlike 1.0, it is more barebones (i.e. no postgres server hogging up port 5432, etc…). All I’d like is just the latest install of Docker/Docker-compose and that would be great!


It’s pretty bare. My build shows the Docker versions:

docker-compose version 1.9.0, build 2585387
Docker version 17.03.0-ce, build 60ccb22


Great! Is there a plan to update to a more recent version of docker-compose in there (1.13.0)? (or at least go to 1.10.0?)


As far as I know, yes, but I don’t know the timeline on it.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.