github.com/justincormack/cli@v0.0.0-20201215022714-831ebeae9675/man/src/container/rm.md (about)

     1  **docker container rm** will remove one or more containers from the host node. The
     2  container name or ID can be used. This does not remove images. You cannot
     3  remove a running container unless you use the **-f** option. To see all
     4  containers on a host use the **docker container ls -a** command.
     5  
     6  # EXAMPLES
     7  
     8  ## Removing a container using its ID
     9  
    10  To remove a container using its ID, find either from a **docker ps -a**
    11  command, or use the ID returned from the **docker run** command, or retrieve
    12  it from a file used to store it using the **docker run --cidfile**:
    13  
    14      docker container rm abebf7571666
    15  
    16  ## Removing a container using the container name
    17  
    18  The name of the container can be found using the **docker ps -a**
    19  command. The use that name as follows:
    20  
    21      docker container rm hopeful_morse
    22  
    23  ## Removing a container and all associated volumes
    24  
    25      $ docker container rm -v redis
    26      redis
    27  
    28  This command will remove the container and any volumes associated with it.
    29  Note that if a volume was specified with a name, it will not be removed.
    30  
    31      $ docker create -v awesome:/foo -v /bar --name hello redis
    32      hello
    33      $ docker container rm -v hello
    34  
    35  In this example, the volume for `/foo` will remain in tact, but the volume for
    36  `/bar` will be removed. The same behavior holds for volumes inherited with
    37  `--volumes-from`.