2022-09-12 13:55:23 +01:00
|
|
|
# docker compose
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
> Run and manage multi container docker applications.
|
2021-10-13 18:23:45 +01:00
|
|
|
> More information: <https://docs.docker.com/compose/reference/>.
|
2017-08-31 09:55:23 +01:00
|
|
|
|
2019-10-30 12:59:17 +00:00
|
|
|
- List all running containers:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose ps`
|
2019-10-30 12:59:17 +00:00
|
|
|
|
2017-08-31 09:55:23 +01:00
|
|
|
- Create and start all containers in the background using a `docker-compose.yml` file from the current directory:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose up -d`
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
- Start all containers, rebuild if necessary:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose up --build`
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
- Start all containers using an alternate compose file:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose --file {{path/to/file}} up`
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
- Stop all running containers:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose stop`
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
- Stop and remove all containers, networks, images, and volumes:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose down --rmi all --volumes`
|
2017-08-31 09:55:23 +01:00
|
|
|
|
|
|
|
- Follow logs for all containers:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose logs --follow`
|
2020-10-24 13:59:15 +01:00
|
|
|
|
|
|
|
- Follow logs for a specific container:
|
|
|
|
|
2022-09-12 13:55:23 +01:00
|
|
|
`docker compose logs --follow {{container_name}}`
|