Docker 29 cheatsheet

Docker 29: Docker Compose

8 common Docker 29 tasks.

Start the services

Build if needed and start everything in compose.yaml in the background.

docker compose up -d

Stop and remove the services

Stop and remove the containers and networks. Volumes are kept.

docker compose down

Stop and remove services and volumes

Also delete the named volumes declared in the file.

docker compose down -v

Caution: Deletes the volumes' data, such as a database.

List the services

Show the containers of the project.

docker compose ps

Follow a service's logs

Stream the logs of one service.

docker compose logs -f web

Rebuild the images

Build the images of services that have a build section.

docker compose build

Open a shell in a service

Run a shell inside a running service container.

docker compose exec web sh

Check the merged config

Validate the file and print it with variables and overrides applied.

docker compose config

Was this page helpful?