LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

docker-container-ls

list containers on the system

TLDR

List running containers
$ docker container ls
copy
List all containers
$ docker container ls -a
copy
List with specific format
$ docker container ls --format "{{.Names}}: {{.Status}}"
copy
Filter by status
$ docker container ls -f status=[running|exited|paused]
copy
Show only IDs
$ docker container ls -q
copy
Filter by name
$ docker container ls -f name=[container_name]
copy
Show the last created container
$ docker container ls --latest
copy

SYNOPSIS

docker container ls [options]

DESCRIPTION

docker container ls lists containers on the Docker host, providing information about container IDs, images, commands, creation time, status, ports, and names. By default, only running containers are displayed, but the -a flag reveals all containers regardless of state.This command is equivalent to the legacy docker ps command and serves as the primary interface for viewing container inventory. Filtering and formatting options make it suitable for scripting and automation workflows.

PARAMETERS

-a, --all

Show all containers (default shows running).
-q, --quiet
Only display container IDs.
-f, --filter filter
Filter output based on conditions (e.g., status, name, label, ancestor, network, exited).
--format string
Format output using Go template.
-n, --last n
Show n last created containers (includes all states).
-l, --latest
Show the most recently created container (includes all states).
-s, --size
Display total file sizes.
--no-trunc
Do not truncate output.

SEE ALSO

Copied to clipboard
Kai