docker-compose version: 1.27.0 - Date: June 2022
Info
Show the docker-compose versiondocker-compose version
Display help and usage instructions for a command
docker-compose help
Manage containers
Build, (re)create and start containers
docker-compose up [options] [SERVICE]
- Start all containers in background:
docker-compose up -d
Stop containers and remove containers, networks, volumes, and images created.
docker-compose down [options]
Restart all stopped and running services
docker-compose restart [options] [SERVICE]
Create containers (without starting them)
docker-compose create [options] [SERVICE]
- Build images before creating containers:
docker-compose create --build
Removes stopped service containers
docker-compose rm [options] [SERVICE]
- Stop the containers, if required, before removing:
docker-compose rm --stop
Set the number of containers to run for an existing service
docker-compose scale SERVICE=NUM
- Scale the service web with 3 containers:
docker-compose scale web=3
Start existing containers for a service
docker-compose start SERVICE
Stop running containers (without removing them)
docker-compose stop SERVICE
Pause running containers of a service
docker-compose pause SERVICE
Unpause paused containers of a service
docker-compose unpause SERVICE
Run a one-time command against a service
docker-compose run [options] SERVICE [COMMAND]
- Start the web service and runs bash as its command:
docker-compose run web bash
Force running containers to stop by sending a SIGKILL signal
docker-compose kill [options] [SERVICE]
- Kill all containers with SIGINT signal:
docker-compose kill -s SIGINT