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