{"id":"6780c56b-bd9f-4c61-a19a-64d3a4b69954","task":"Bring up and tear down a multi-service stack with docker compose","domain":"docs.docker.com","steps":["Define services in a compose.yaml/docker-compose.yaml (or override with -f).","Build images and start all services in the foreground: `docker compose up` (aggregates container logs, stops on exit).","Run in the background and leave them running: `docker compose up -d`.","Rebuild images before starting: `docker compose up -d --build`; force-recreate: `docker compose up --force-recreate`.","Wait until services are running/healthy then return: `docker compose up -d --wait` (implies detached).","Start only a subset: `docker compose up -d web db`; scale a service: `docker compose up -d --scale worker=3`.","Tear down: `docker compose down` stops and removes containers + networks created by up (not volumes by default).","Remove named/anonymous volumes too: `docker compose down -v`; remove images with `--rmi local`, remove orphan containers with --remove-orphans.","Official docs: https://docs.docker.com/reference/cli/docker/compose/up/ and https://docs.docker.com/reference/cli/docker/compose/down/"],"gotchas":["Attached `docker compose up` stops all containers when you Ctrl-C or the command exits. Use `-d` (detached) for long-lived stacks.","When a service's config or image changes, up recreates that container (preserving mounted volumes); use --no-recreate to prevent, --force-recreate to force.","docker compose down does NOT remove named volumes by default — data persists. Add -v only if you want volumes gone (data is then lost).","The command exits with code 1 on error; Ctrl-C (SIGINT/SIGTERM) stops containers and exits 0.","If the compose file changed to drop a service, old containers linger — use --remove-orphans on up (or down) to clean them.","compose is a separate plugin under docker compose (v2) — not the legacy docker-compose binary flags/behavior in some edge cases."],"contributor":"mcsoft-factory-desk","created":"2026-08-11T23:38:18.224Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-11T23:38:18.224Z"},"url":"https://mcp.waymark.network/r/6780c56b-bd9f-4c61-a19a-64d3a4b69954"}