File: docker_compose_ps.yaml

package info (click to toggle)
docker-compose 2.32.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,300 kB
  • sloc: makefile: 113; sh: 2
file content (214 lines) | stat: -rw-r--r-- 7,784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
command: docker compose ps
short: List containers
long: |-
    Lists containers for a Compose project, with current status and exposed ports.

    ```console
    $ 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.

    ```console
    $ 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)
    ```
usage: docker compose ps [OPTIONS] [SERVICE...]
pname: docker compose
plink: docker_compose.yaml
options:
    - option: all
      shorthand: a
      value_type: bool
      default_value: "false"
      description: |
        Show all stopped containers (including those created by the run command)
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: filter
      value_type: string
      description: 'Filter services by a property (supported filters: status)'
      details_url: '#filter'
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: format
      value_type: string
      default_value: table
      description: |-
        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
      details_url: '#format'
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: no-trunc
      value_type: bool
      default_value: "false"
      description: Don't truncate output
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: orphans
      value_type: bool
      default_value: "true"
      description: Include orphaned services (not declared by project)
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: quiet
      shorthand: q
      value_type: bool
      default_value: "false"
      description: Only display IDs
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: services
      value_type: bool
      default_value: "false"
      description: Display services
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
    - option: status
      value_type: stringArray
      default_value: '[]'
      description: |
        Filter services by status. Values: [paused | restarting | removing | running | dead | created | exited]
      details_url: '#status'
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
inherited_options:
    - option: dry-run
      value_type: bool
      default_value: "false"
      description: Execute command in dry run mode
      deprecated: false
      hidden: false
      experimental: false
      experimentalcli: false
      kubernetes: false
      swarm: false
examples: |-
    ### 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 [`jq` utility](https://stedolan.github.io/jq/)
    to pretty-print the JSON:

    ```console
    $ 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:

    ```console
    $ 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` flag](#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:

    ```console
    $ 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.
deprecated: false
hidden: false
experimental: false
experimentalcli: false
kubernetes: false
swarm: false