Man page - docker-compose-ps(1)
Packages contains this manual
- docker-compose-wait(1)
- docker-compose-exec(1)
- docker-compose-build(1)
- docker-compose-port(1)
- docker-compose-up(1)
- docker-compose-alpha-publish(1)
- docker-compose-down(1)
- docker-compose-unpause(1)
- docker-compose-top(1)
- docker-compose-create(1)
- docker-compose-alpha-viz(1)
- docker-compose-alpha(1)
- docker-compose-version(1)
- docker-compose-images(1)
- docker-compose-stop(1)
- docker-compose-restart(1)
- docker-compose-kill(1)
- docker-compose-start(1)
- docker-compose-run(1)
- docker-compose-ps(1)
- docker-compose-pause(1)
- docker-compose-stats(1)
- docker-compose-scale(1)
- docker-compose(1)
- docker-compose-logs(1)
- docker-compose-pull(1)
- docker-compose-push(1)
- docker-compose-rm(1)
- docker-compose-config(1)
- docker-compose-ls(1)
- docker-compose-watch(1)
- docker-compose-events(1)
- docker-compose-cp(1)
- docker-compose-attach(1)
apt-get install docker-compose
Manual
DOCKER-COMPOSE-PS
NAMESYNOPSIS
DESCRIPTION
OPTIONS
OPTIONS INHERITED FROM PARENT COMMANDS
EXAMPLE
Filter containers by status (--status) {#status}
Filter containers by status (--filter) {#filter}
SEE ALSO
NAME
docker-compose-ps - List containers
SYNOPSIS
docker compose ps [OPTIONS] [SERVICE...]
DESCRIPTION
Lists containers for a Compose project, with current status and exposed ports.
$ docker compose
ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
example-foo-1 alpine "/entrypoint.ā¦" foo 4
seconds ago Up 2 seconds 0.0.0.0:8080->80/tcp
By default, only running containers are shown. --all flag can be used to include stopped containers.
$ docker compose
ps --all
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
example-foo-1 alpine "/entrypoint.ā¦" foo 4
seconds ago Up 2 seconds 0.0.0.0:8080->80/tcp
example-bar-1 alpine "/entrypoint.ā¦" bar 4
seconds ago exited (0)
OPTIONS
|
-a , --all [=false] |
Show all stopped containers (including those created by the run command) |
||
|
--filter ="" |
Filter services by a property (supported filters: status) |
||
|
--format ="table" |
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 |
||
|
-h , --help [=false] |
help for ps |
||
|
--no-trunc [=false] |
Donāt truncate output |
||
|
--orphans [=true] |
Include orphaned services (not declared by project) |
||
|
-q , --quiet [=false] |
Only display IDs |
||
|
--services [=false] |
Display services |
||
|
--status =[] |
Filter services by status. Values: [paused | restarting | removing | running | dead | created | exited] |
OPTIONS INHERITED FROM PARENT COMMANDS
|
--dry-run [=false] |
Execute command in dry run mode |
EXAMPLE
### Format the output (--format) {#format}
By default, the
ādocker compose psā command uses a table
("pretty") format to
show the containers. The ā--formatā flag allows
you to specify alternative
presentations for the output. Currently, supported options
are āprettyā (default),
and ājsonā, which outputs information about the
containers as a JSON array:
āāāconsole
$ docker compose ps --format json
[{"ID":"1553b0236cf4d2715845f053a4ee97042c4f9a2ef655731ee34f1f7940eaa41a","Name":"example-bar-1","Command":"/docker-entrypoint.sh
nginx -g ādaemon
off;ā","Project":"example","Service":"bar","State":"exited","Health":"","ExitCode":0,"Publishers":null},{"ID":"f02a4efaabb67416e1ff127d51c4b5578634a0ad5743bd65225ff7d1909a3fa0","Name":"example-foo-1","Command":"/docker-entrypoint.sh
nginx -g ādaemon
off;ā","Project":"example","Service":"foo","State":"running","Health":"","ExitCode":0,"Publishers":[{"URL":"0.0.0.0","TargetPort":80,"PublishedPort":8080,"Protocol":"tcp"}]}]
The JSON output allows you to use the information in other tools for further processing, for example, using the ⨠https://stedolan.github.io/jq/⩠to pretty-print the JSON:
$ docker compose
ps --format json | jq .
[
{
"ID":
"1553b0236cf4d2715845f053a4ee97042c4f9a2ef655731ee34f1f7940eaa41a",
"Name": "example-bar-1",
"Command": "/docker-entrypoint.sh nginx -g
ādaemon off;ā",
"Project": "example",
"Service": "bar",
"State": "exited",
"Health": "",
"ExitCode": 0,
"Publishers": null
},
{
"ID":
"f02a4efaabb67416e1ff127d51c4b5578634a0ad5743bd65225ff7d1909a3fa0",
"Name": "example-foo-1",
"Command": "/docker-entrypoint.sh nginx -g
ādaemon off;ā",
"Project": "example",
"Service": "foo",
"State": "running",
"Health": "",
"ExitCode": 0,
"Publishers": [
{
"URL": "0.0.0.0",
"TargetPort": 80,
"PublishedPort": 8080,
"Protocol": "tcp"
}
]
}
]
Filter containers by status (--status) {#status}
Use the --status flag to filter the list of containers by status. For example, to show only containers that are running or only containers that have exited:
$ docker compose
ps --status=running
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
example-foo-1 alpine "/entrypoint.ā¦" foo 4
seconds ago Up 2 seconds 0.0.0.0:8080->80/tcp
$ docker compose
ps --status=exited
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
example-bar-1 alpine "/entrypoint.ā¦" bar 4
seconds ago exited (0)
Filter containers by status (--filter) {#filter}
The ⨠#status⩠is a convenient shorthand for the --filter status=<status> flag. The example below is the equivalent to the example from the previous section, this time using the --filter flag:
$ docker compose
ps --filter status=running
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
example-foo-1 alpine "/entrypoint.ā¦" foo 4
seconds ago Up 2 seconds 0.0.0.0:8080->80/tcp
The docker compose ps command currently only supports the --filter status=<status> option, but additional filter options may be added in the future. āāā
SEE ALSO
docker-compose(1)