Docker rm Command
docker rm: Remove one or more containers.
Syntax
docker rm [OPTIONS] CONTAINER [CONTAINER...]
OPTIONS Description:
-
-f: Forcefully remove a running container via SIGKILL signal.
-
-l: Remove the network connection between containers, not the containers themselves.
-
-v: Remove the volumes associated with the container.
Examples
Forcefully remove containers db01 and db02:
docker rm -f db01 db02
Remove the connection between container nginx01 and container db01 with connection name db:
docker rm -l db
Remove container nginx01 and its associated data volumes:
docker rm -v nginx01
Remove all stopped containers:
docker rm $(docker ps -a -q)
>
For more information, see: Docker Cleanup Command