✦ For everyone, free.

Practical knowledge for real and everyday life

Home

9.4.2.1 Down Service Removal

A focused guide to Down Service Removal, connecting core concepts with practical Docker and container operations.

Down service removal is the part of docker compose down's overall behavior responsible for stopping and removing every service container belonging to the Compose application, returning the system to a state with none of that application's containers present.

How Service Containers Are Stopped and Removed

For each running service, Compose first stops the container (allowing it a grace period to shut down cleanly), then removes it entirely.

docker compose down
Stopping myapp_api_1 ... done
Stopping myapp_db_1  ... done
Removing myapp_api_1 ... done
Removing myapp_db_1  ... done

Each service's container is both stopped and removed as part of this single command.

Why This Differs From Stop Alone

docker compose stop only stops containers without removing them, leaving them available to be restarted later with docker compose startdown's removal goes further, actually deleting the containers entirely.

docker compose stop
docker compose start
docker compose down
docker compose up -d

The first pair reuses the exact same, still-existing containers; the second pair creates entirely new containers, since the originals were removed by down.

Why Container Removal Doesn't Affect Named Volume Data

Removing a service's container has no effect on data stored in a named volume that container was using, since that volume exists independently and persists through this removal.

services:
  db:
    volumes:
      - pgdata:/var/lib/postgresql/data
Confirming Containers Were Actually Removed

Checking that no containers remain for this application validates the removal completed as expected.

docker compose ps -a
Why Down Service Removal Matters

This thorough container removal is what makes down a genuinely clean teardown, ensuring a subsequent up creates fresh containers reflecting the current Compose configuration, rather than potentially reusing stale, previously configured containers.