Docker Compose is a tool for managing Docker powered applications that consists of multiple containers. The way it works is that you describe the services that your container needs in a single file (the Docker Compose file) that lists out what services your application needs and creates the relevant containers for them by pulling down the relevant images from the web. For example, you might have a compose file that looks like:

version '2'
       image: postgres
        build: .
        command: bundle exec rails s -p 3000 -b ''
           - .:/myapp
           - "3000:3000"
           - db

This compose file spins up a basic Ruby on Rails app with a Postgres database. There’s some details about the container settings in this file such as what the name of the app is, where it should looks for files, and what port to run it on. If you’re experienced in Rails development, this should all look very familiar to you.

The compose file can be written to add additional services as needed for you application. If you’d like a step by step guide on getting Rails up and running using Docker Compose, check out my free guide here!