github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/docs/source/markdown/podman-rm.1.md (about)

     1  % podman-rm(1)
     2  
     3  ## NAME
     4  podman\-rm - Remove one or more containers
     5  
     6  ## SYNOPSIS
     7  **podman rm** [*options*] *container*
     8  
     9  **podman container rm** [*options*] *container*
    10  
    11  ## DESCRIPTION
    12  **podman rm** will remove one or more containers from the host.  The container name or ID can be used.  This does not remove images.
    13  Running or unusable containers will not be removed without the **-f** option.
    14  
    15  ## OPTIONS
    16  
    17  #### **--all**, **-a**
    18  
    19  Remove all containers.  Can be used in conjunction with **-f** as well.
    20  
    21  #### **--cidfile**
    22  
    23  Read container ID from the specified file and remove the container.  Can be specified multiple times.
    24  
    25  #### **--depend**
    26  
    27  Remove selected container and recursively remove all containers that depend on it.
    28  
    29  #### **--force**, **-f**
    30  
    31  Force the removal of running and paused containers. Forcing a container removal also
    32  removes containers from container storage even if the container is not known to podman.
    33  Containers could have been created by a different container engine.
    34  In addition, forcing can be used to remove unusable containers, e.g. containers
    35  whose OCI runtime has become unavailable.
    36  
    37  #### **--ignore**, **-i**
    38  
    39  Ignore errors when specified containers are not in the container store.  A user
    40  might have decided to manually remove a container which would lead to a failure
    41  during the ExecStop directive of a systemd service referencing that container.
    42  
    43  #### **--latest**, **-l**
    44  
    45  Instead of providing the container name or ID, use the last created container. If you use methods other than Podman
    46  to run containers such as CRI-O, the last started container could be from either of those methods. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
    47  
    48  #### **--time**, **-t**=*seconds*
    49  
    50  Seconds to wait before forcibly stopping the container. The --force option must be specified to use the --time option.
    51  
    52  #### **--volumes**, **-v**
    53  
    54  Remove anonymous volumes associated with the container. This does not include named volumes
    55  created with **podman volume create**, or the **--volume** option of **podman run** and **podman create**.
    56  
    57  ## EXAMPLE
    58  Remove a container by its name *mywebserver*
    59  ```
    60  $ podman rm mywebserver
    61  ```
    62  
    63  Remove a *mywebserver* container and all of the containers that depend on it
    64  ```
    65  $ podman rm --depend mywebserver
    66  ```
    67  
    68  Remove several containers by name and container id.
    69  ```
    70  $ podman rm mywebserver myflaskserver 860a4b23
    71  ```
    72  
    73  Remove several containers reading their IDs from files.
    74  ```
    75  $ podman rm --cidfile ./cidfile-1 --cidfile /home/user/cidfile-2
    76  ```
    77  
    78  Forcibly remove a container by container ID.
    79  ```
    80  $ podman rm -f 860a4b23
    81  ```
    82  
    83  Remove all containers regardless of its run state.
    84  ```
    85  $ podman rm -f -a
    86  ```
    87  
    88  Forcibly remove the latest container created.
    89  ```
    90  $ podman rm -f --latest
    91  ```
    92  
    93  ## Exit Status
    94    **0**   All specified containers removed
    95  
    96    **1**   One of the specified containers did not exist, and no other failures
    97  
    98    **2**   One of the specified containers is paused or running
    99  
   100    **125** The command fails for any other reason
   101  
   102  ## SEE ALSO
   103  **[podman(1)](podman.1.md)**, **[crio(8)](https://github.com/cri-o/cri-o/blob/main/docs/crio.8.md)**
   104  
   105  ## HISTORY
   106  August 2017, Originally compiled by Ryan Cole <rycole@redhat.com>