snippetbashTip
docker compose — Run and manage multi container Docker applications. More information: <https://docs.docker.com/refer
Viewed 0 times
commandrunanddocker composeclimanagemulticontainer
Problem
How to use the
docker compose command: Run and manage multi container Docker applications. More information: <https://docs.docker.com/reference/cli/docker/compose/>.Solution
docker compose — Run and manage multi container Docker applications. More information: <https://docs.docker.com/reference/cli/docker/compose/>.List all running containers:
docker compose psCreate and start all containers in the background using a
docker-compose.yml file from the current directory:docker compose up {{[-d|--detach]}}Start all containers, rebuild if necessary:
docker compose up --buildStart all containers by specifying a project name and using an alternate compose file:
docker compose {{[-p|--project-name]}} {{project_name}} {{[-f|--file]}} {{path/to/file}} upStop all running containers:
docker compose stopStop and remove all containers, networks, images, and volumes:
docker compose down --rmi all {{[-v|--volumes]}}Follow logs for all containers:
docker compose logs {{[-f|--follow]}}Follow logs for a specific container:
docker compose logs {{[-f|--follow]}} {{container_name}}Code Snippets
List all running containers
docker compose psCreate and start all containers in the background using a `docker-compose.yml` file from the current directory
docker compose up {{[-d|--detach]}}Start all containers, rebuild if necessary
docker compose up --buildStart all containers by specifying a project name and using an alternate compose file
docker compose {{[-p|--project-name]}} {{project_name}} {{[-f|--file]}} {{path/to/file}} upStop all running containers
docker compose stopContext
tldr-pages: common/docker compose
Revisions (0)
No revisions yet.