9.4.2 Compose Down
A focused guide to Compose Down, connecting core concepts with practical Docker and container operations.
docker compose down stops and removes a Compose application's containers, along with the networks Compose created for it, providing a clean teardown counterpart to up, while preserving named volumes by default unless explicitly told otherwise.
The Basic Teardown
Running down without additional flags stops and removes every service container and any networks Compose created.
docker compose down
Why Volumes Survive a Plain Down by Default
Named volumes declared in the Compose file are not removed by a plain down, reflecting the understanding that persistent data generally shouldn't be casually discarded just because the application's containers are being torn down.
docker compose down
docker compose up -d
Data in any named volumes survives this entire sequence, since down alone left them intact.
Explicitly Removing Volumes as Well
The -v flag extends down's teardown to also remove declared volumes, a more thorough but also more destructive operation.
docker compose down -v
This should be used deliberately, with full awareness that any data in the affected volumes will be permanently lost.
Removing Images as Part of Teardown
An additional flag can also remove images that were built or pulled specifically for this application, useful for a particularly thorough cleanup.
docker compose down --rmi local
This removes images that Compose built locally for this application, while leaving externally pulled images untouched.
Why Compose Down Matters
As the natural counterpart to up, down provides a clean, reliable way to tear down a Compose application's running state, with its default behavior of preserving volumes reflecting a sensible, safety-conscious default that requires deliberate, explicit action to override.