How can I use docker-compose and docker exec?

docker

#1

I was using docker-compose fine after including docker 1.10 on circleci. But now I also want to use docker exec and apparently circleci doesn’t support that? Is there a workaround?


#2

Not sure what you’re using docker exec for in your case, but in mine, I run tests in my containers after building them from docker-compose. In that case, I write a separate docker-compose.circleci.yml for circleci with settings appropriate to that environment.

The option --abort-on-container-exit will tear down your swarm when one of the containers exits, for example when your tests finish. E.g.:

docker-compose -f docker-compose.yml -f docker-compose.circleci.yml up --abort-on-container-exit

By not using the -d option with docker-compose all of the output gets passed along to CircleCI.


#3