Using docker-compose on Travis CI

Image for post
Image for post

If you are not familiar with Dockeryou can read about it in my other article. In this article I’m talking specifically about docker-compose; the tool for building multiple containers (as most application stacks will require).

docker-composeis great. It can be used to deploy to your dev machines, your production application and of course your CI. I’m quite fond of Travis CIbecause it has seamless integration with Github, is free (for public repositories) and works very well with any type of project or build process you want to throw at it.

At the time of writing this Travis has most Docker tools preinstalled, but they are at older versions. So you will have to update them as part of the build script — this adds a little bit of time to the build and some time in the future you can remove that code.

I am going to assume you are familiar with the Travis YAML configuration. Here are the bits that matter:

env:
# You may want to update this to whatever the latest version is, or keep it
# the same as your local machines. However, I have only tested it with 1.8.0+.
# There should be a time in the future when this is not necessary - it is
# explained in more detail below.
DOCKER_COMPOSE_VERSION: 1.8.0

Originally published at http://elliot.land on August 27, 2016.

Written by

I’m a data nerd and TDD enthusiast originally from Sydney. Currently working for Uber in New York. My thoughts here are my own. 🤓 elliotchance@gmail.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store