I have created some integration tests for my open-sourced code and I am looking for a publicly accessible CI service to host them. As Travis-CI has to small quotas for all my containers, I think I will use CircleCI. This is my cirle.yml
:
machine:
services:
- docker
dependencies:
override:
- pip install docker-compose
test:
override:
- cd integration-tests && docker-compose run --rm runner
However after running this I get error message "client and server don't have same version (client : 1.18, server: 1.16)" What is my problem?
@zefciu This config just worked for me
machine:
services:
- docker
dependencies:
override:
- sudo pip install -U docker-compose==1.3.3
test:
override:
- docker-compose -f <compose-file> build && docker-compose -f <compose-file> up
With extensive help of Support and some trial and error I found two problems with my configuration:
- The default docker version on CircleCI is incompatible with newest docker-compose.
- Removal of containers is impossible, so the --rm flag will cause the build to go red even if tests pass.
The correct configuration therefore will look like this:
machine:
services:
- docker
pre:
- sudo curl -sSL https://get.docker.com/ | sh
dependencies:
override:
- pip install docker-compose
test:
override:
- cd integration-tests && docker-compose run runner
UPDATE: It's not needed anymore, CircleCI has Docker v1.8.2 by default now
You can update docker version like this:
machine:
services:
- docker
pre:
- docker --version
- sudo curl -L -o /usr/bin/docker 'http://s3-external-1.amazonaws.com/circle-downloads/docker-1.8.2-circleci'
- sudo chmod 0755 /usr/bin/docker
- docker --version
You can replace 1.8.2
in the amazon S3 link to the version you want
you can do this by using --net=host
when running your container, this will allow you to access Circle CI services via localhost
. With this you don't need to use docker-compose
. Circle CI provides most services for you.
machine:
services:
- docker
- mysql
- redis
...
test:
override:
- |
docker run \
--net=host \
--env MYSQL_HOST=localhost \
--env MYSQL_PORT=3306 \
--env MYSQL_DATABASE=circle_test \
--env MYSQL_USERNAME=ubuntu \
--env REDIS_HOST=localhost \
--env REDIS_PORT=$REDIS_PORT \
my/container runner