docker-compose-down
Stop and remove Docker Compose services
TLDR
Stop and remove all containers and networks
Stop and remove containers, networks, and all images used by services
Stop and remove containers, networks, and only images without a custom tag
Stop and remove containers, networks, and all volumes
Stop and remove everything including orphaned containers
Stop and remove containers using an alternate compose file
Stop and remove containers with a custom timeout in seconds
Remove containers for services not defined in the Compose file
SYNOPSIS
docker-compose down [OPTIONS] [SERVICE...]
PARAMETERS
--volumes, -v
Remove named volumes declared in the volumes section and anonymous volumes attached to containers
--rmi all|local
all: remove all images used by stack; local: remove local images without custom tags
--remove-orphans
Remove containers for services not defined in the Compose file
-t, --timeout TIMEOUT
Graceful shutdown timeout in seconds (default: 10)
DESCRIPTION
The docker-compose down command stops and removes containers, networks, and optionally volumes and images defined in a Docker Compose file (typically docker-compose.yml). It sends a SIGTERM signal to containers, waiting up to 10 seconds by default before forcing shutdown with SIGKILL. Networks created by Compose are always removed, but volumes and images are preserved unless specified otherwise. This command is essential for cleaning up after development or testing sessions, reverting the environment to a clean state. It targets the default project name derived from the directory or explicitly set via COMPOSE_PROJECT_NAME. When service names are provided, only those services and their dependencies are affected. Orphaned containers (not in the Compose file) can be removed with an option. Ideal for workflows involving docker-compose up followed by down to manage ephemeral services.
CAVEATS
Preserves volumes and images by default; does not delete the Compose file or project directory. Use with caution in production to avoid data loss.
EXAMPLES
docker-compose down
Stop and remove all services.
docker-compose down --volumes --rmi all
Full cleanup including volumes and images.
docker-compose down --remove-orphans -t 30
Remove orphans with 30s timeout.
HISTORY
Introduced in Docker Compose 1.0 (2014) as part of core lifecycle management. Evolved with v1.6+ adding volume/image removal; now integrated as docker compose down plugin in Docker CLI v2+.


