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

     1  % podman-ps(1)
     2  
     3  ## NAME
     4  podman\-ps - Prints out information about containers
     5  
     6  ## SYNOPSIS
     7  **podman ps** [*options*]
     8  
     9  **podman container ps** [*options*]
    10  
    11  **podman container list** [*options*]
    12  
    13  **podman container ls** [*options*]
    14  
    15  ## DESCRIPTION
    16  **podman ps** lists the running containers on the system. Use the **--all** flag to view
    17  all the containers information.  By default it lists:
    18  
    19   * container id
    20   * the name of the image the container is using
    21   * the COMMAND the container is executing
    22   * the time the container was created
    23   * the status of the container
    24   * port mappings the container is using
    25   * alternative names for the container
    26  
    27  ## OPTIONS
    28  
    29  #### **--all**, **-a**
    30  
    31  Show all the containers created by Podman, default is only running containers.
    32  
    33  Note: Podman shares containers storage with other tools such as Buildah and CRI-O. In some cases these `external` containers might also exist in the same storage. Use the `--external` option to see these external containers. External containers show the 'storage' status.
    34  
    35  #### **--external**
    36  
    37  Display external containers that are not controlled by Podman but are stored in containers storage.  These external containers are generally created via other container technology such as Buildah or CRI-O and may depend on the same container images that Podman is also using.  External containers are denoted with either a 'buildah' or 'storage' in the COMMAND and STATUS column of the ps output.
    38  
    39  #### **--filter**, **-f**
    40  
    41  Filter what containers are shown in the output.
    42  Multiple filters can be given with multiple uses of the --filter flag.
    43  Filters with the same key work inclusive with the only exception being
    44  `label` which is exclusive. Filters with different keys always work exclusive.
    45  
    46  Valid filters are listed below:
    47  
    48  | **Filter**      | **Description**                                                                  |
    49  | --------------- | -------------------------------------------------------------------------------- |
    50  | id              | [ID] Container's ID (accepts regex)                                              |
    51  | name            | [Name] Container's name (accepts regex)                                          |
    52  | label           | [Key] or [Key=Value] Label assigned to a container                               |
    53  | exited          | [Int] Container's exit code                                                      |
    54  | status          | [Status] Container's status: 'created', 'exited', 'paused', 'running', 'unknown' |
    55  | ancestor        | [ImageName] Image or descendant used to create container                         |
    56  | before          | [ID] or [Name] Containers created before this container                          |
    57  | since           | [ID] or [Name] Containers created since this container                           |
    58  | volume          | [VolumeName] or [MountpointDestination] Volume mounted in container              |
    59  | health          | [Status] healthy or unhealthy                                                    |
    60  | pod             | [Pod] name or full or partial ID of pod                                          |
    61  | network         | [Network] name or full ID of network                                             |
    62  
    63  
    64  #### **--format**=*format*
    65  
    66  Pretty-print containers to JSON or using a Go template
    67  
    68  Valid placeholders for the Go template are listed below:
    69  
    70  | **Placeholder** | **Description**                                  |
    71  | --------------- | ------------------------------------------------ |
    72  | .ID             | Container ID                                     |
    73  | .Image          | Image Name/ID                                    |
    74  | .ImageID        | Image ID                                         |
    75  | .Command        | Quoted command used                              |
    76  | .CreatedAt      | Creation time for container                      |
    77  | .RunningFor     | Time elapsed since container was started         |
    78  | .Status         | Status of container                              |
    79  | .Pod            | Pod the container is associated with             |
    80  | .Ports          | Exposed ports                                    |
    81  | .Size           | Size of container                                |
    82  | .Names          | Name of container                                |
    83  | .Networks       | Show all networks connected to the container     |
    84  | .Labels         | All the labels assigned to the container         |
    85  | .Mounts         | Volumes mounted in the container                 |
    86  
    87  #### **--help**, **-h**
    88  
    89  Print usage statement
    90  
    91  #### **--last**, **-n**
    92  
    93  Print the n last created containers (all states)
    94  
    95  #### **--latest**, **-l**
    96  
    97  Show the latest container created (all states) (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
    98  
    99  #### **--namespace**, **--ns**
   100  
   101  Display namespace information
   102  
   103  #### **--no-trunc**
   104  
   105  Do not truncate the output (default *false*).
   106  
   107  #### **--noheading**
   108  
   109  Omit the table headings from the listing of containers.
   110  
   111  #### **--pod**, **-p**
   112  
   113  Display the pods the containers are associated with
   114  
   115  #### **--quiet**, **-q**
   116  
   117  Print the numeric IDs of the containers only
   118  
   119  #### **--size**, **-s**
   120  
   121  Display the total file size
   122  
   123  #### **--sort**=*created*
   124  
   125  Sort by command, created, id, image, names, runningfor, size, or status",
   126  Note: Choosing size will sort by size of rootFs, not alphabetically like the rest of the options
   127  
   128  #### **--sync**
   129  
   130  Force a sync of container state with the OCI runtime.
   131  In some cases, a container's state in the runtime can become out of sync with Podman's state.
   132  This will update Podman's state based on what the OCI runtime reports.
   133  Forcibly syncing is much slower, but can resolve inconsistent state issues.
   134  
   135  #### **--watch**, **-w**
   136  
   137  Refresh the output with current containers on an interval in seconds.
   138  
   139  ## EXAMPLES
   140  
   141  ```
   142  $ podman ps -a
   143  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES
   144  02f65160e14ca  redis:alpine  "redis-server"  19 hours ago  Exited (-1) 19 hours ago  6379/tcp  k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0
   145  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   146  ```
   147  
   148  ```
   149  $ podman ps -a -s
   150  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES                                                                  SIZE
   151  02f65160e14ca  redis:alpine  "redis-server"  20 hours ago  Exited (-1) 20 hours ago  6379/tcp  k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0  27.49 MB
   152  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1         27.49 MB
   153  ```
   154  
   155  ```
   156  $ podman ps -a --format "{{.ID}}  {{.Image}}  {{.Labels}}  {{.Mounts}}"
   157  02f65160e14ca  redis:alpine  tier=backend  proc,tmpfs,devpts,shm,mqueue,sysfs,cgroup,/var/run/,/var/run/
   158  69ed779d8ef9f  redis:alpine  batch=no,type=small  proc,tmpfs,devpts,shm,mqueue,sysfs,cgroup,/var/run/,/var/run/
   159  ```
   160  
   161  ```
   162  $ podman ps --ns -a
   163  CONTAINER ID    NAMES                                                                   PID     CGROUP       IPC          MNT          NET          PIDNS        USER         UTS
   164  3557d882a82e3   k8s_container2_podsandbox1_redhat.test.crio_redhat-test-crio_1          29910   4026531835   4026532585   4026532593   4026532508   4026532595   4026531837   4026532594
   165  09564cdae0bec   k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1          29851   4026531835   4026532585   4026532590   4026532508   4026532592   4026531837   4026532591
   166  a31ebbee9cee7   k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0   29717   4026531835   4026532585   4026532587   4026532508   4026532589   4026531837   4026532588
   167  ```
   168  
   169  ```
   170  $ podman ps -a --size --sort names
   171  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES
   172  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   173  02f65160e14ca  redis:alpine  "redis-server"  19 hours ago  Exited (-1) 19 hours ago  6379/tcp  k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0
   174  ```
   175  
   176  ```
   177  $ podman ps
   178  CONTAINER ID  IMAGE                            COMMAND    CREATED        STATUS            PORTS                                                   NAMES
   179  4089df24d4f3  docker.io/library/centos:latest  /bin/bash  2 minutes ago  Up 2 minutes ago  0.0.0.0:80->8080/tcp, 0.0.0.0:2000-2006->2000-2006/tcp  manyports
   180  92f58933c28c  docker.io/library/centos:latest  /bin/bash  3 minutes ago  Up 3 minutes ago  192.168.99.100:1000-1006->1000-1006/tcp                 zen_sanderson
   181  
   182  ```
   183  
   184  ```
   185  $ podman ps --external -a
   186  CONTAINER ID  IMAGE                             COMMAND  CREATED      STATUS  PORTS  NAMES
   187  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   188  38a8a78596f9  docker.io/library/busybox:latest  buildah  2 hours ago  storage        busybox-working-container
   189  fd7b786b5c32  docker.io/library/alpine:latest   buildah  2 hours ago  storage        alpine-working-container
   190  f78620804e00  scratch                           buildah  2 hours ago  storage        working-container
   191  ```
   192  
   193  ## ps
   194  Print a list of containers
   195  
   196  ## SEE ALSO
   197  **[podman(1)](podman.1.md)**, **[buildah(1)](https://github.com/containers/buildah/blob/main/docs/buildah.1.md)**, **[crio(8)](https://github.com/cri-o/cri-o/blob/main/docs/crio.8.md)**
   198  
   199  ## HISTORY
   200  August 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>