github.com/containers/podman/v5@v5.1.0-rc1/docs/source/markdown/podman-rm.1.md.in (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** removes 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 are not 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  @@option cidfile.read
    22  
    23  Command does not fail when *file* is missing and user specified --ignore.
    24  
    25  #### **--depend**
    26  
    27  Remove selected container and recursively remove all containers that depend on it.
    28  
    29  #### **--filter**=*filter*
    30  
    31  Filter what containers remove.
    32  Multiple filters can be given with multiple uses of the --filter flag.
    33  Filters with the same key work inclusive with the only exception being
    34  `label` which is exclusive. Filters with different keys always work exclusive.
    35  
    36  Valid filters are listed below:
    37  
    38  | **Filter** | **Description**                                                                  |
    39  |------------|----------------------------------------------------------------------------------|
    40  | id         | [ID] Container's ID (CID prefix match by default; accepts regex)                 |
    41  | name       | [Name] Container's name (accepts regex)                                          |
    42  | label      | [Key] or [Key=Value] Label assigned to a container                               |
    43  | exited     | [Int] Container's exit code                                                      |
    44  | status     | [Status] Container's status: 'created', 'exited', 'paused', 'running', 'unknown' |
    45  | ancestor   | [ImageName] Image or descendant used to create container                         |
    46  | before     | [ID] or [Name] Containers created before this container                          |
    47  | since      | [ID] or [Name] Containers created since this container                           |
    48  | volume     | [VolumeName] or [MountpointDestination] Volume mounted in container              |
    49  | health     | [Status] healthy or unhealthy                                                    |
    50  | pod        | [Pod] name or full or partial ID of pod                                          |
    51  | network    | [Network] name or full ID of network                                             |
    52  | until      | [DateTime] Containers created before the given duration or time.                 |
    53  
    54  #### **--force**, **-f**
    55  
    56  Force the removal of running and paused containers. Forcing a container removal also
    57  removes containers from container storage even if the container is not known to Podman.
    58  For example, containers that are created by different container engines like Buildah.
    59  In addition, forcing can be used to remove unusable containers, e.g. containers
    60  whose OCI runtime has become unavailable.
    61  
    62  @@option ignore
    63  Further ignore when the specified `--cidfile` does not exist as it may have
    64  already been removed along with the container.
    65  
    66  @@option latest
    67  
    68  @@option time
    69  
    70  The --force option must be specified to use the --time option.
    71  
    72  #### **--volumes**, **-v**
    73  
    74  Remove anonymous volumes associated with the container. This does not include named volumes
    75  created with **podman volume create**, or the **--volume** option of **podman run** and **podman create**.
    76  
    77  ## EXAMPLE
    78  Remove container with a given name:
    79  ```
    80  $ podman rm mywebserver
    81  ```
    82  
    83  Remove container with a given name and all of the containers that depend on it:
    84  ```
    85  $ podman rm --depend mywebserver
    86  ```
    87  
    88  Remove multiple containers with given names or IDs:
    89  ```
    90  $ podman rm mywebserver myflaskserver 860a4b23
    91  ```
    92  
    93  Remove multiple containers with IDs read from files:
    94  ```
    95  $ podman rm --cidfile ./cidfile-1 --cidfile /home/user/cidfile-2
    96  ```
    97  
    98  Forcibly remove container with a given ID:
    99  ```
   100  $ podman rm -f 860a4b23
   101  ```
   102  
   103  Remove all containers regardless of the run state:
   104  ```
   105  $ podman rm -f -a
   106  ```
   107  
   108  Forcibly remove the last created container. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines):
   109  ```
   110  $ podman rm -f --latest
   111  ```
   112  
   113  ## Exit Status
   114    **0**   All specified containers removed
   115  
   116    **1**   One of the specified containers did not exist, and no other failures
   117  
   118    **2**   One of the specified containers is paused or running
   119  
   120    **125** The command fails for any other reason
   121  
   122  ## SEE ALSO
   123  **[podman(1)](podman.1.md)**
   124  
   125  ## HISTORY
   126  August 2017, Originally compiled by Ryan Cole <rycole@redhat.com>