github.com/ph/moby@v1.13.1/man/docker-rm.1.md (about)

     1  % DOCKER(1) Docker User Manuals
     2  % Docker Community
     3  % JUNE 2014
     4  # NAME
     5  docker-rm - Remove one or more containers
     6  
     7  # SYNOPSIS
     8  **docker rm**
     9  [**-f**|**--force**]
    10  [**-l**|**--link**]
    11  [**-v**|**--volumes**]
    12  CONTAINER [CONTAINER...]
    13  
    14  # DESCRIPTION
    15  
    16  **docker rm** will remove one or more containers from the host node. The
    17  container name or ID can be used. This does not remove images. You cannot
    18  remove a running container unless you use the **-f** option. To see all
    19  containers on a host use the **docker ps -a** command.
    20  
    21  # OPTIONS
    22  **--help**
    23    Print usage statement
    24  
    25  **-f**, **--force**=*true*|*false*
    26     Force the removal of a running container (uses SIGKILL). The default is *false*.
    27  
    28  **-l**, **--link**=*true*|*false*
    29     Remove the specified link and not the underlying container. The default is *false*.
    30  
    31  **-v**, **--volumes**=*true*|*false*
    32     Remove the volumes associated with the container. The default is *false*.
    33  
    34  # EXAMPLES
    35  
    36  ## Removing a container using its ID
    37  
    38  To remove a container using its ID, find either from a **docker ps -a**
    39  command, or use the ID returned from the **docker run** command, or retrieve
    40  it from a file used to store it using the **docker run --cidfile**:
    41  
    42      docker rm abebf7571666
    43  
    44  ## Removing a container using the container name
    45  
    46  The name of the container can be found using the **docker ps -a**
    47  command. The use that name as follows:
    48  
    49      docker rm hopeful_morse
    50  
    51  ## Removing a container and all associated volumes
    52  
    53      $ docker rm -v redis
    54      redis
    55  
    56  This command will remove the container and any volumes associated with it.
    57  Note that if a volume was specified with a name, it will not be removed.
    58  
    59      $ docker create -v awesome:/foo -v /bar --name hello redis
    60      hello
    61      $ docker rm -v hello
    62  
    63  In this example, the volume for `/foo` will remain in tact, but the volume for
    64  `/bar` will be removed. The same behavior holds for volumes inherited with
    65  `--volumes-from`.
    66  
    67  # HISTORY
    68  April 2014, Originally compiled by William Henry (whenry at redhat dot com)
    69  based on docker.com source material and internal work.
    70  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
    71  July 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
    72  August 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>