2014-04-16 18:07:55 +00:00
|
|
|
% DOCKER(1) Docker User Manuals
|
2014-07-01 02:58:04 +00:00
|
|
|
% Docker Community
|
|
|
|
% JUNE 2014
|
2014-04-16 18:07:55 +00:00
|
|
|
# NAME
|
2014-07-01 02:58:04 +00:00
|
|
|
docker-rm - Remove one or more containers
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
# SYNOPSIS
|
2014-07-01 02:58:04 +00:00
|
|
|
**docker rm**
|
2015-12-23 14:37:06 +00:00
|
|
|
[**-f**|**--force**]
|
|
|
|
[**-l**|**--link**]
|
|
|
|
[**-v**|**--volumes**]
|
2014-11-28 04:21:55 +00:00
|
|
|
CONTAINER [CONTAINER...]
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
**docker rm** 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
|
2015-07-26 02:18:48 +00:00
|
|
|
remove a running container unless you use the **-f** option. To see all
|
2014-04-16 18:07:55 +00:00
|
|
|
containers on a host use the **docker ps -a** command.
|
|
|
|
|
|
|
|
# OPTIONS
|
2014-10-15 21:14:12 +00:00
|
|
|
**--help**
|
|
|
|
Print usage statement
|
|
|
|
|
2014-08-17 23:31:58 +00:00
|
|
|
**-f**, **--force**=*true*|*false*
|
|
|
|
Force the removal of a running container (uses SIGKILL). The default is *false*.
|
|
|
|
|
2014-04-16 18:07:55 +00:00
|
|
|
**-l**, **--link**=*true*|*false*
|
2014-07-01 02:58:04 +00:00
|
|
|
Remove the specified link and not the underlying container. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
**-v**, **--volumes**=*true*|*false*
|
2014-07-01 02:58:04 +00:00
|
|
|
Remove the volumes associated with the container. The default is *false*.
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
# EXAMPLES
|
|
|
|
|
2015-10-13 15:12:30 +00:00
|
|
|
## Removing a container using its ID
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
To remove a container using its ID, find either from a **docker ps -a**
|
|
|
|
command, or use the ID returned from the **docker run** command, or retrieve
|
2014-04-17 15:36:58 +00:00
|
|
|
it from a file used to store it using the **docker run --cidfile**:
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
docker rm abebf7571666
|
|
|
|
|
2015-10-13 15:12:30 +00:00
|
|
|
## Removing a container using the container name
|
2014-04-16 18:07:55 +00:00
|
|
|
|
|
|
|
The name of the container can be found using the **docker ps -a**
|
|
|
|
command. The use that name as follows:
|
|
|
|
|
|
|
|
docker rm hopeful_morse
|
|
|
|
|
2016-01-22 02:57:53 +00:00
|
|
|
## Removing a container and all associated volumes
|
|
|
|
|
2016-02-25 01:48:21 +00:00
|
|
|
$ docker rm -v redis
|
|
|
|
redis
|
2016-01-22 02:57:53 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2016-02-25 01:48:21 +00:00
|
|
|
$ docker create -v awesome:/foo -v /bar --name hello redis
|
|
|
|
hello
|
|
|
|
$ docker rm -v hello
|
2016-01-22 02:57:53 +00:00
|
|
|
|
|
|
|
In this example, the volume for `/foo` will remain in tact, but the volume for
|
|
|
|
`/bar` will be removed. The same behavior holds for volumes inherited with
|
|
|
|
`--volumes-from`.
|
|
|
|
|
2014-04-16 18:07:55 +00:00
|
|
|
# HISTORY
|
2014-04-17 15:36:58 +00:00
|
|
|
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
2014-07-02 00:30:25 +00:00
|
|
|
based on docker.com source material and internal work.
|
2014-07-03 01:07:42 +00:00
|
|
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2014-07-23 02:40:10 +00:00
|
|
|
July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2014-08-17 23:31:58 +00:00
|
|
|
August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|