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


#1

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?


#2

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.


#3

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


#4

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


#5

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.


#6

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.


#7

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


#8

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!


#9

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

https://circleci.com/gh/ryanwohara/test-2.0/287

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

#10

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?)


#11

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


#12

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