Using docker-compose in 2.0


#1

We have a multi container setup and use docker-compose to manage them. Ideally, we would want to use docker-compose to manage/compose our images instead of ‘containerInfo’. Can this be done? Is there an executorType: docker-compose ?


Getting Started: Configuration
Getting Started: Configuration
#2

Just use executorType: machine and use docker-compose as you would normally. It’s brief, but there is some documentation on it here:


#3

I am trying to experiment with how our docker-compose based work flow will change based on what executorType we choose.

The example project here: https://github.com/circleci/cci-demo-flask only has docker executorType. I wish it had executorType: machine example also. Probably a circle.machine.yml. Are you guys thinking about adding it?


#4

@sul4bh I ported PrestoDB to 2.0 and used the machine configuration. It’s open source, so feel free to reference it as an example.


#5

Is it a fair assumption that there is a speed penalty when using machine instead of docker?


#6

Yes, there’s an overhead for provisioning a machine executor–the delay comes from spinning up a private Docker server for you.

In contrast, a Docker executor runs on a shared Docker server that’s already provisioned. We lock down some Docker behavior on this executor to secure your builds. This restricts your ability to use docker-compose.


#7

So this mean that for example i cannot use volumes? i have a docker-compose file that share local directories with container inside as a volume common notation:

version: '2’
services:
ci:
image: php
volumes:
- .:/var/www
working_dir: /var/www

But inside container there is nothing under /var/www

Is this related to the confinement that you mention or there is anything i need to do or im doing wrong?

Thanks


#8

I believe that should work with executorType: machine, but not with executorType: docker. Which one were you trying to run this on?


#9

With executorType: docker. Any specific reason for that? i know that when you request a docker engine like type: setup-docker-engine circle provides a remote engine created with docker-machine but it should also work


#10

i know that when you request a docker engine like type: setup-docker-engine circle provides a remote engine created with docker-machine but it should also work

You’re correct that executorType: docker combined with setup-docker-engine provides a remote engine like one created with docker-machine. Volume mounting and port forwarding don’t work as one would expect in this setup. From what I understand, Docker running on Mac had/has similar limitations.

This build combination is mainly intended for users who want to build docker images and deploy them, but don’t need to get into more complex Docker setups–like performing volume mounting.

@bitgandtter If you’ve tried the executorType: machine already, it’d be helpful to hear what’s not working out with that.


Spinning up two containers that need to communicate
#11

#12

#13

We have included documentation for using docker compose in 2.0

https://circleci.com/docs/2.0/docker-compose/


#14