LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

Which Docker Compose commands manage a stack's lifecycle, and when do you use build: instead of image:?

docker compose up -d creates and starts everything, logs/top observe it, down stops and removes it; build: <folder> builds the service from a Dockerfile, together with up --build.

Command Effect
docker compose up -d Creates the networks and volumes, pulls or builds images, starts all services in the background
docker compose up --build -d Same, but rebuilds images from their Dockerfiles first
docker compose ps Lists the stack's containers
docker compose logs --tail=10 Last 10 log lines of every service (useful with -d, where logs aren't on screen)
docker compose top The processes running inside each service's containers
docker compose down Stops and removes containers and networks; named volumes stay unless you add -v

image: vs build:

  • image: mysql:5.7 uses a ready-made image from a registry (or one already built locally).
  • build: backend tells Compose to build the image from the Dockerfile in the backend/ folder. That is how your own services enter the stack. Without --build, Compose reuses an image it built earlier, so code changes would not show up.

Compose names its resources after the project (the folder name by default), for example dockercompose_db_data and dockercompose_default, so several stacks on one host don't collide.

Go deeper:

From Quiz: ISLAB / Docker Introduction | Updated: Dec 01, 2026