DOCKER(1) Docker User Manuals DOCKER(1)

# [NAME](#NAME)

docker-container-ls - List containers

# [SYNOPSIS](#SYNOPSIS)

**docker container ls \[OPTIONS]**

# [DESCRIPTION](#DESCRIPTION)

List the containers in the local repository. By default this shows only the running containers.

# [Filters](#Filters)

Filter output based on these conditions:  
\- ancestor=(\[:tag]||image@digest ⟨mailto:image@digest⟩)  
containers created from an image or a descendant.  
\- before=(|)  
\- expose=(\[/]|/\[])  
\- exited= an exit code of  
\- health=(starting|healthy|unhealthy|none)  
\- id= a container's ID  
\- isolation=(**default**|**process**|**hyperv**) (Windows daemon only)  
\- is-task=(true|false)  
\- label= or label==  
\- name= a container's name  
\- network=(|)  
\- publish=(\[/]|/\[])  
\- since=(|)  
\- status=(created|restarting|removing|running|paused|exited)  
\- volume=(|)

# [Format](#Format)

The formatting option (**--format**) pretty-prints container output using a Go template.

Valid placeholders for the Go template are listed below:  
\- .ID - Container ID.  
\- .Image - Image ID.  
\- .Command - Quoted command.  
\- .CreatedAt - Time when the container was created.  
\- .RunningFor - Elapsed time since the container was started.  
\- .Ports - Exposed ports.  
\- .Status - Container status.  
\- .Size - Container disk size.  
\- .Names - Container names.  
\- .Labels - All labels assigned to the container.  
\- .Label - Value of a specific label for this container.  
For example **'{{.Label "com.docker.swarm.cpu"}}'**.  
\- .Mounts - Names of the volumes mounted in this container.  
\- .Networks - Names of the networks attached to this container.

# [EXAMPLES](#EXAMPLES)

# [Display all containers, including non-running](#Display_all_containers,_including_non-running)

```
$ docker container ls -a
CONTAINER ID        IMAGE                 COMMAND                CREATED             STATUS      PORTS    NAMES
a87ecb4f327c        ubuntu:24.04          /bin/sh -c #(nop) MA   20 minutes ago      Exit 0               desperate_brattain
01946d9d34d8        busybox               /bin/sh -c #(nop) MA   33 minutes ago      Exit 0               thirsty_bell
c1d3b0166030        acffc0358b9e          /bin/sh -c yum -y up   2 weeks ago         Exit 1               determined_torvalds
41d50ecd2f57        ubuntu:24.04          /bin/sh -c #(nop) MA   2 weeks ago         Exit 0               drunk_pike
```

# [Display only IDs of all containers, including non-running](#Display_only_IDs_of_all_containers,_including_non-running)

```
$ docker container ls -a -q
a87ecb4f327c
01946d9d34d8
c1d3b0166030
41d50ecd2f57
```

# [Display only IDs of all containers that have the name **determined\_torvalds**](#Display_only_IDs_of_all_containers_that_have_the_name_)

```
$ docker container ls -a -q --filter=name=determined_torvalds
c1d3b0166030
```

# [Display containers with their commands](#Display_containers_with_their_commands)

```
$ docker container ls --format "{{.ID}}: {{.Command}}"
a87ecb4f327c: /bin/sh -c #(nop) MA
01946d9d34d8: /bin/sh -c #(nop) MA
c1d3b0166030: /bin/sh -c yum -y up
41d50ecd2f57: /bin/sh -c #(nop) MA
```

# [Display containers with their labels in a table](#Display_containers_with_their_labels_in_a_table)

```
$ docker container ls --format "table {{.ID}}\t{{.Labels}}"
CONTAINER ID        LABELS
a87ecb4f327c        com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd
01946d9d34d8
c1d3b0166030        com.docker.swarm.node=debian,com.docker.swarm.cpu=6
41d50ecd2f57        com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd
```

# [Display containers with their node label in a table](#Display_containers_with_their_node_label_in_a_table)

```
$ docker container ls --format 'table {{.ID}}\t{{(.Label "com.docker.swarm.node")}}'
CONTAINER ID        NODE
a87ecb4f327c        worker-1
01946d9d34d8
c1d3b0166030        worker-1
41d50ecd2f57        worker-2
```

# [Display containers with **remote-volume** mounted](#Display_containers_with_)

```
$ docker container ls --filter volume=remote-volume --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID        MOUNTS
9c3527ed70ce        remote-volume
```

# [Display containers with a volume mounted in **/data**](#Display_containers_with_a_volume_mounted_in_)

```
$ docker container ls --filter volume=/data --format "table {{.ID}}\t{{.Mounts}}"
CONTAINER ID        MOUNTS
9c3527ed70ce        remote-volume
```

# [Display containers that have published port of 80:](#Display_containers_that_have_published_port_of_80:)

```
$ docker ps --filter publish=80
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS              PORTS                   NAMES
fc7e477723b7        busybox             "top"               About a minute ago   Up About a minute   0.0.0.0:32768->80/tcp   admiring_roentgen
```

# [Display containers that have exposed TCP port in the range of **8000-8080**:](#Display_containers_that_have_exposed_TCP_port_in_the_range_of_)

```
$ docker ps --filter expose=8000-8080/tcp
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
9833437217a5        busybox             "top"               21 seconds ago      Up 19 seconds       8080/tcp            dreamy_mccarthy
```

# [Display containers in JSON format:](#Display_containers_in_JSON_format:)

```
$ docker ps --format json
{"Command":"\"/docker-entrypoint.…\"","CreatedAt":"2021-03-10 00:15:05 +0100 CET","ID":"a762a2b37a1d","Image":"nginx","Labels":"maintainer=NGINX Docker Maintainers \u003cdocker-maint@nginx.com\u003e","LocalVolumes":"0","Mounts":"","Names":"boring_keldysh","Networks":"bridge","Ports":"80/tcp","RunningFor":"4 seconds ago","Size":"0B","State":"running","Status":"Up 3 seconds"}
```

# [OPTIONS](#OPTIONS)

**-a**, **--all**\[=false] Show all containers (default shows just running)

**-f**, **--filter**= Filter output based on conditions provided

**--format**="" Format output using a custom template: 'table': Print output in table format with column headers (default) 'table TEMPLATE': Print output in table format using the given Go template 'json': Print in JSON format 'TEMPLATE': Print output using the given Go template. Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates

**-n**, **--last**=-1 Show n last created containers (includes all states)

**-l**, **--latest**\[=false] Show the latest created container (includes all states)

**--no-trunc**\[=false] Don't truncate output

**-q**, **--quiet**\[=false] Only display container IDs

**-s**, **--size**\[=false] Display total file sizes

# [SEE ALSO](#SEE_ALSO)

[**docker-container(1)**](/man/enterprise-packages/docker-cli-fips/docker-container.1)

Oct 2026 Docker Community

---

Document: docker-container-ls(1) from docker-cli-fips 29.9.2-r1 (Chainguard OS)
Source: https://github.com/docker/cli
