✦ For everyone, free.

Practical knowledge for real and everyday life

Home

9.4.2.5 Down Cleanup Behavior

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

Down cleanup behavior encompasses the full range of what docker compose down actually removes (and what it deliberately leaves untouched) by default, plus the additional flags available to extend this cleanup further when a more thorough teardown is genuinely needed.

What a Plain Down Removes

Without any additional flags, down removes the application's service containers and any networks Compose created for it.

docker compose down

This leaves named volumes, external networks, and any images intact, removing only what's specifically tied to this particular application's running containers and Compose-created networking.

Extending Cleanup to Include Volumes

The -v flag adds volume removal to this default behavior.

docker compose down -v
Extending Cleanup to Include Locally Built Images

The --rmi flag, with either local or all, additionally removes images, with local limiting this to images Compose itself built and all extending it to every image used by the application, including pulled ones.

docker compose down --rmi local
Combining Multiple Cleanup Flags for a Maximally Thorough Teardown

These flags can be combined for the most complete cleanup Compose's down command supports.

docker compose down -v --rmi local

This removes containers, Compose-created networks, declared volumes, and locally built images, leaving very little behind from this particular application's footprint.

Why Understanding the Full Range of Down's Cleanup Options Matters

Knowing exactly what each level of down's cleanup behavior removes — from the conservative default to the more thorough, explicitly requested options — allows for choosing precisely the right amount of teardown for a given situation, whether a routine restart or a genuinely complete reset.