Course outline · 0% complete

0/29 lessons0%

Course overview →

Compose day to day

lesson 5-3 · ~11 min · 16/29

The five commands you actually use

docker compose up -d          # create/start everything in the background
docker compose ps             # status of this project's services
docker compose logs -f app    # follow one service's logs
docker compose up -d --build  # rebuild images that changed, then restart
docker compose down           # stop and remove containers + network

Notes that save you pain:

  • up is idempotent: run it again and compose only recreates services whose config or image changed
  • After editing your code you need --build, otherwise compose happily reuses the stale image from lesson 3-1's last build
  • down keeps named volumes by default, so your database from lesson 4-1 survives. down -v deletes volumes too, which is the reset-everything button. Say it out loud before pressing it

Practice the day-to-day loop on the shop app from lesson 5-1 in this simulated shell.

Step 1/5: Boot the whole stack in the background.

~/shop $ 

Quiz

You edited server.py, ran `docker compose up -d`, and the running app still shows the old behavior. What went wrong?

Quiz

Your local dev database is full of broken test data and you want a completely fresh start, empty database included. Which command?

Problem

Which single command stops and removes all of a compose project's containers and its network, while keeping named volumes?