Skip to content

Instantly share code, notes, and snippets.

@quangkeu95
Last active November 22, 2017 03:12
Show Gist options
  • Save quangkeu95/a32e12179b9590c5f9625f58f50b15e2 to your computer and use it in GitHub Desktop.
Save quangkeu95/a32e12179b9590c5f9625f58f50b15e2 to your computer and use it in GitHub Desktop.

Install Docker Compose on Linux distribution

Get the latest version of Docker Compose on Docker Compose release page

To install

curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version

To uninstall sudo rm /usr/local/bin/docker-compose

Quick start Docker Compose

Getting started

Some useful command with docker-compose

Bring up services:

  • Foreground: docker-compose up
  • Background: docker-compose up -d Note: When running docker-compose in background, you may want to stop services after you have done your work by using command: docker-compose stop.

Bring down services:

docker-compose down Passing flag --volumes to remove volumes using by your containers.

Specify docker-compose file

Normally, you must be inside a docker-compose project with docker-compose.yaml file in order to user most of docker-compose command, or you can use docker-compose -f <path/to/docker-compose-file> <command> to run command on specific docker-compose project.

Define project name

Project name is used with your service name to create container name: Container Name = Project Name_Service Name_1

By default, project name is the name of the directory which contains docker-compose file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment