github.com/containers/podman/v2@v2.2.2-0.20210501105131-c1e07d070c4c/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. Only used with the --all option.
    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  
    61  #### **--format**=*format*
    62  
    63  Pretty-print containers to JSON or using a Go template
    64  
    65  Valid placeholders for the Go template are listed below:
    66  
    67  | **Placeholder** | **Description**                                  |
    68  | --------------- | ------------------------------------------------ |
    69  | .ID             | Container ID                                     |
    70  | .Image          | Image Name/ID                                    |
    71  | .ImageID        | Image ID                                         |
    72  | .Command        | Quoted command used                              |
    73  | .CreatedAt      | Creation time for container                      |
    74  | .RunningFor     | Time elapsed since container was started         |
    75  | .Status         | Status of container                              |
    76  | .Pod            | Pod the container is associated with             |
    77  | .Ports          | Exposed ports                                    |
    78  | .Size           | Size of container                                |
    79  | .Names          | Name of container                                |
    80  | .Labels         | All the labels assigned to the container         |
    81  | .Mounts         | Volumes mounted in the container                 |
    82  
    83  #### **--help**, **-h**
    84  
    85  Print usage statement
    86  
    87  #### **--last**, **-n**
    88  
    89  Print the n last created containers (all states)
    90  
    91  #### **--latest**, **-l**
    92  
    93  Show the latest container created (all states)
    94  
    95  The latest option is not supported on the remote client.
    96  
    97  #### **--namespace**, **--ns**
    98  
    99  Display namespace information
   100  
   101  #### **--no-trunc**
   102  
   103  Display the extended information
   104  
   105  #### **--pod**, **-p**
   106  
   107  Display the pods the containers are associated with
   108  
   109  #### **--quiet**, **-q**
   110  
   111  Print the numeric IDs of the containers only
   112  
   113  #### **--sort**
   114  
   115  Sort by command, created, id, image, names, runningfor, size, or status",
   116  Note: Choosing size will sort by size of rootFs, not alphabetically like the rest of the options
   117  Default: created
   118  
   119  #### **--size**, **-s**
   120  
   121  Display the total file size
   122  
   123  #### **--sync**
   124  
   125  Force a sync of container state with the OCI runtime.
   126  In some cases, a container's state in the runtime can become out of sync with Podman's state.
   127  This will update Podman's state based on what the OCI runtime reports.
   128  Forcibly syncing is much slower, but can resolve inconsistent state issues.
   129  
   130  #### **--watch**, **-w**
   131  
   132  Refresh the output with current containers on an interval in seconds.
   133  
   134  ## EXAMPLES
   135  
   136  ```
   137  $ podman ps -a
   138  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES
   139  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
   140  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   141  ```
   142  
   143  ```
   144  $ podman ps -a -s
   145  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES                                                                  SIZE
   146  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
   147  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1         27.49 MB
   148  ```
   149  
   150  ```
   151  $ podman ps -a --format "{{.ID}}  {{.Image}}  {{.Labels}}  {{.Mounts}}"
   152  02f65160e14ca  redis:alpine  tier=backend  proc,tmpfs,devpts,shm,mqueue,sysfs,cgroup,/var/run/,/var/run/
   153  69ed779d8ef9f  redis:alpine  batch=no,type=small  proc,tmpfs,devpts,shm,mqueue,sysfs,cgroup,/var/run/,/var/run/
   154  ```
   155  
   156  ```
   157  $ podman ps --ns -a
   158  CONTAINER ID    NAMES                                                                   PID     CGROUP       IPC          MNT          NET          PIDNS        USER         UTS
   159  3557d882a82e3   k8s_container2_podsandbox1_redhat.test.crio_redhat-test-crio_1          29910   4026531835   4026532585   4026532593   4026532508   4026532595   4026531837   4026532594
   160  09564cdae0bec   k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1          29851   4026531835   4026532585   4026532590   4026532508   4026532592   4026531837   4026532591
   161  a31ebbee9cee7   k8s_podsandbox1-redis_podsandbox1_redhat.test.crio_redhat-test-crio_0   29717   4026531835   4026532585   4026532587   4026532508   4026532589   4026531837   4026532588
   162  ```
   163  
   164  ```
   165  $ podman ps -a --size --sort names
   166  CONTAINER ID   IMAGE         COMMAND         CREATED       STATUS                    PORTS     NAMES
   167  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   168  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
   169  ```
   170  
   171  ```
   172  $ podman ps
   173  CONTAINER ID  IMAGE                            COMMAND    CREATED        STATUS            PORTS                                                   NAMES
   174  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
   175  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
   176  
   177  ```
   178  
   179  ```
   180  $ podman ps --external -a
   181  CONTAINER ID  IMAGE                             COMMAND  CREATED      STATUS  PORTS  NAMES
   182  69ed779d8ef9f  redis:alpine  "redis-server"  25 hours ago  Created                   6379/tcp  k8s_container1_podsandbox1_redhat.test.crio_redhat-test-crio_1
   183  38a8a78596f9  docker.io/library/busybox:latest  buildah  2 hours ago  storage        busybox-working-container
   184  fd7b786b5c32  docker.io/library/alpine:latest   buildah  2 hours ago  storage        alpine-working-container
   185  f78620804e00  scratch                           buildah  2 hours ago  storage        working-container
   186  ```
   187  
   188  ## ps
   189  Print a list of containers
   190  
   191  ## SEE ALSO
   192  podman(1), buildah(1), crio(8)
   193  
   194  ## HISTORY
   195  August 2017, Originally compiled by Urvashi Mohnani <umohnani@redhat.com>