LinuxCommandLibrary

docker-rm

remove stopped containers from the system

TLDR

Remove a container

$ docker rm [container]
copy
Remove multiple containers
$ docker rm [container1] [container2]
copy
Force remove running container
$ docker rm -f [container]
copy
Remove container and volumes
$ docker rm -v [container]
copy
Remove all stopped containers
$ docker rm $(docker ps -aq)
copy

SYNOPSIS

docker rm [options] container [container...]

DESCRIPTION

docker rm removes one or more containers. Containers must be stopped unless -f is used. Does not remove images; use docker rmi for that. Container removal frees up disk space and cleans up container metadata from the Docker daemon. Named volumes are preserved unless explicitly removed with -v.

PARAMETERS

-f, --force

Force removal of running container.
-l, --link
Remove specified link.
-v, --volumes
Remove anonymous volumes attached to container.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community