.nh .TH "DOCKER" "1" "Dec 2020" "Docker Community" "Docker User Manuals" .SH NAME .PP docker\-container\-rm \- Remove one or more containers .SH SYNOPSIS .PP \fBdocker container rm [OPTIONS] CONTAINER [CONTAINER...]\fP .SH DESCRIPTION .PP \fBdocker container rm\fP will remove one or more containers from the host node. The container name or ID can be used. This does not remove images. You cannot remove a running container unless you use the \fB\-f\fP option. To see all containers on a host use the \fBdocker container ls \-a\fP command. .SH EXAMPLES .SH Removing a container using its ID .PP To remove a container using its ID, find either from a \fBdocker ps \-a\fP command, or use the ID returned from the \fBdocker run\fP command, or retrieve it from a file used to store it using the \fBdocker run \-\-cidfile\fP: .PP .RS .nf docker container rm abebf7571666 .fi .RE .SH Removing a container using the container name .PP The name of the container can be found using the \fBdocker ps \-a\fP command. The use that name as follows: .PP .RS .nf docker container rm hopeful\_morse .fi .RE .SH Removing a container and all associated volumes .PP .RS .nf $ docker container rm \-v redis redis .fi .RE .PP This command will remove the container and any volumes associated with it. Note that if a volume was specified with a name, it will not be removed. .PP .RS .nf $ docker create \-v awesome:/foo \-v /bar \-\-name hello redis hello $ docker container rm \-v hello .fi .RE .PP In this example, the volume for \fB\fC/foo\fR will remain in tact, but the volume for \fB\fC/bar\fR will be removed. The same behavior holds for volumes inherited with \fB\fC\-\-volumes\-from\fR\&. .SH OPTIONS .PP \fB\-f\fP, \fB\-\-force\fP[=false] Force the removal of a running container (uses SIGKILL) .PP \fB\-h\fP, \fB\-\-help\fP[=false] help for rm .PP \fB\-l\fP, \fB\-\-link\fP[=false] Remove the specified link .PP \fB\-v\fP, \fB\-\-volumes\fP[=false] Remove anonymous volumes associated with the container .SH SEE ALSO .PP \fBdocker\-container(1)\fP