docker-container-remove
Remove existing Docker containers
TLDR
View documentation for the original command
SYNOPSIS
docker container rm [OPTIONS] CONTAINER [CONTAINER...]
PARAMETERS
-f, --force
Force removal of a running container (uses SIGKILL)
-h, --help
Print usage information
-l, --link
Remove the specified link to a container
-v, --volumes
Remove anonymous volumes associated with the container
DESCRIPTION
The docker container rm command deletes one or more stopped containers from a Docker host. Equivalent to docker rm, it permanently removes container instances, freeing disk space and resources. Running containers cannot be removed without the -f or --force option, which sends SIGKILL to force stop and delete.
Containers are lightweight, isolated environments for applications. This command deletes the writable layer and metadata but preserves named volumes unless -v is used for anonymous volumes. Use docker container ls -a to list all containers, including stopped ones, for identification by ID or name.
Common use cases include cleanup after testing, CI/CD pipelines, or managing fleets. Multiple containers can be specified at once. Errors occur if containers don't exist or are in use.
CAVEATS
Cannot remove running containers without -f; does not affect named volumes; container must exist and not be renamed/linked without -l. Use docker container prune for bulk cleanup of stopped containers.
EXAMPLES
docker container rm abc123
Remove stopped container by ID.
docker container rm -f myapp
Force remove running container by name.
docker container rm -v $(docker container ls -aq)
Remove all containers and anonymous volumes.
HISTORY
Introduced in Docker 1.13.0 (January 2017) with structured CLI subcommands like docker container. docker rm existed since early Docker versions (2013). Enhanced in later releases for better volume handling.


