Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

docker compose rm command

docker compose rm command

Docker Command ReferenceDocker Command Reference


The docker compose rm command removes stopped service containers.

The docker compose rm command does not remove running containers; it is mainly used to clean up stopped or no-longer-needed containers to free system resources.

Syntax

docker compose rm [OPTIONS] [SERVICE...]

OPTIONS:

Example

1. Remove all stopped service containers



docker compose rm

Lists all stopped service containers and prompts whether to remove them.

** 2. Force-remove all stopped service containers**



docker compose rm -f

Directly removes stopped containers without prompting for confirmation.

** 3. Remove stopped containers of a specific service**



docker compose rm web

Only removes stopped containers of the web service.

4. Remove and clean up related volumes



docker compose rm -v

Removes stopped containers and also deletes their associated volumes.


Docker Command ReferenceDocker Command Reference