Chapter Summary: Multi-Container Apps with Compose

Summarize the concepts covered in this chapter.

We'll cover the following

Commands

Let’s explore all the Docker Compose commands covered in this chapter.

  • docker compose up deploys a Compose app. It creates all images, containers, networks, and volumes the app needs. It expects you to call the Compose file compose.yaml, but you can specify a custom file name with the -f flag. You’ll normally start the app in the background with the --detach flag.

  • docker compose stop will stop all containers in a Compose app without deleting them from the system. You can easily restart them with docker compose restart, and you shouldn’t lose any data.

  • docker compose restart will restart a stopped Compose app. If you make changes to the Compose file while it’s stopped, these changes will not appear in the restarted app. You need to redeploy the app to see any changes you made in the Compose file.

  • docker compose ps lists each container in the Compose app. It shows the current state, the command each container is running, and network ports.

  • docker compose down will stop and delete a running Compose app. By default, it deletes containers and networks but not volumes and images.

Get hands-on with 1400+ tech skills courses.