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
- Foreground:
docker-compose up
- Background:
docker-compose up -d
Note: When runningdocker-compose
in background, you may want to stop services after you have done your work by using command:docker-compose stop
.
docker-compose down
Passing flag --volumes
to remove volumes using by your containers.
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.
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.