CircleCI 2.0, docker-compose and Docker executor: have my cake and eat it, too?


After reading a bunch of posts around Docker, docker-compose and CircleCI 2.0, I understand that the use case for the docker executor is for “light” uses of Docker, people who don’t use Docker in their tests (from this comment: Building a docker image in docker executor). If you need to use volumes, you should use the machine executor.

While I understand this restriction, my tests don’t need to use volumes: it just so happens that my docker-compose.yml file has a volume that makes development easier.

Here’s a snippet from the docker-compose.yml file. (The stack is Django, FWIW, and we use docker-compose for local development. There are three other services in the file.)

version: '2'
    build: .
       - .:/usr/src/app

If I remove this volume, everything works fine in the docker executor.

One solution I might like is to have a second docker compose file that I can use to override and remove that volume. After looking at the docker-compose.yml documentation, it doesn’t appear this is possible. The solution I’d like to prevent is to duplicate most of the docker-compose.yml file just to build on CircleCI.

Has anyone else had an issue like this? Is there a good solution I’m not thinking of?

I understand this isn’t strictly a CircleCI 2.0 question. However, it becomes important if the machine executor comes at an additional cost. I can currently get exactly what I want with CircleCI 1.0, and it seems odd that a feature that was previously free (and somewhat basic, IMHO) would now have an additional cost to it.


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