DockerCLI/cli/command
Sebastiaan van Stijn 1fdbd6181e
docker ps: add State field to formatting
The State field allows printing the container state without
additional information about uptime, healthcheck, etc.

With this patch, the container's state can be printed independently:

```bash
docker ps -a --format '{{.State}}'
running
paused
exited
created
```

```bash
docker ps -a --format 'table {{.Names}}\t{{.State}}\t{{.Status}}'
NAMES                     STATE               STATUS
elastic_burnell           running             Up About a minute
pausie                    paused              Up 5 minutes (Paused)
peaceful_stonebraker      exited              Exited (0) 10 hours ago
vigilant_shaw             created             Created
```

```bash
docker ps -a --format 'raw'

container_id: 0445f73f3a71
image: docker-cli-dev
command: "ash"
created_at: 2019-07-12 11:16:11 +0000 UTC
state: running
status: Up 2 minutes
names: elastic_burnell
labels:
ports:

container_id: 1aff69a3912c
image: nginx:alpine
command: "nginx -g 'daemon of ..."
created_at: 2019-07-12 11:12:10 +0000 UTC
state: paused
status: Up 6 minutes (Paused)
names: pausie
labels: maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>
ports: 80/tcp

container_id: d48acf66c318
image: alpine:3.9.3
command: "id -u"
created_at: 2019-07-12 00:52:17 +0000 UTC
state: exited
status: Exited (0) 10 hours ago
names: peaceful_stonebraker
labels:
ports:

container_id: a0733fe0dace
image: b7b28af77ffe
command: "/bin/sh -c '#(nop) ..."
created_at: 2019-07-12 00:51:29 +0000 UTC
state: created
status: Created
names: vigilant_shaw
labels:
ports:
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-07-12 13:31:16 +02:00
..
builder cli-plugins: alias an existing allowed command (only builder for now) 2019-04-19 01:26:45 +00:00
bundlefile Update tests to use gotest.tools 👼 2018-06-08 18:24:26 +02:00
checkpoint formatter package heavy refactoring 2018-10-23 17:05:44 +02:00
commands Merge pull request #1602 from thaJeztah/hide_experimental_deploy 2019-02-08 13:53:12 -08:00
config Fix annnotation on docker config create --template-driver 2019-03-21 16:19:06 +01:00
container Do not disable sig-proxy when using a TTY 2019-06-25 16:29:21 +02:00
context Introduce .zip import for docker context 2019-05-29 12:58:45 -07:00
engine Remove e-mail from trial flow 2019-01-08 00:35:24 +01:00
formatter docker ps: add State field to formatting 2019-07-12 13:31:16 +02:00
idresolver Update tests to use gotest.tools 👼 2018-06-08 18:24:26 +02:00
image vendor buildkit to f238f1e 2019-05-14 01:29:18 +00:00
inspect Update tests to use gotest.tools 👼 2018-06-08 18:24:26 +02:00
manifest Add bash completion for `manifest` command family 2018-08-30 08:54:49 +02:00
network Refactor network parsing, add preliminary support for multiple networks 2019-04-03 16:42:57 +02:00
node Fix tests with missing mocks 2018-11-08 11:37:49 +01:00
plugin Update docker/docker to 827cb09f87964ed38b46502f22a585f2ed4a78e1 2019-03-19 22:21:51 +01:00
registry Add unit test coverage for token auth 2019-04-15 16:13:55 -07:00
secret Fix annotation on docker secret create --template-driver 2019-03-28 16:18:50 +01:00
service Switch to google/shlex 2019-04-13 17:51:15 +02:00
stack Regroup all kubernetes extra-fields under x-kubernetes 2019-04-12 15:46:11 +02:00
swarm Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine 2019-01-28 14:36:00 +01:00
system Use underlying `NewKubernetesConfig` directly from compose-on-kubernetes. 2019-05-14 15:43:15 +01:00
task formatter package heavy refactoring 2018-10-23 17:05:44 +02:00
testdata Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
trust Windows: skip permissions check on key 2019-06-25 00:12:01 +02:00
volume Fix labels copying value from environment variables 2019-03-19 03:01:57 +01:00
cli.go Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
cli_options.go Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
cli_options_test.go Unit test for WithContentTrustFromEnv 2019-01-29 11:26:40 +00:00
cli_test.go Cover the changes with unit test 2019-03-13 14:18:41 +01:00
context.go Cleanup context store interfaces 2019-04-18 15:49:36 +02:00
defaultcontextstore.go Push check for kubernetes requirement down into the endpoint 2019-05-20 13:28:11 +01:00
defaultcontextstore_test.go Dynamically register kubernetes context store endpoint type. 2019-05-20 13:28:11 +01:00
events_utils.go updated vendoring 2017-09-01 19:41:06 -04:00
orchestrator.go Fast Context Switch: commands 2019-01-10 22:25:43 +01:00
orchestrator_test.go Introduce docker context store 2019-01-04 17:06:51 +01:00
registry.go Simplify ElectAuthServer 2019-03-28 21:08:13 +00:00
registry_test.go Remove docker api dependency from cli/config 2019-01-31 21:25:43 +00:00
streams.go Extract streams helpers from command package to their own package to remove a cyclic dependency from command to internal/containerizedengine 2019-01-28 14:36:00 +01:00
trust.go Refactor content_trust cli/flags handling 2018-03-08 15:00:43 -05:00
utils.go cli-plugins: alias an existing allowed command (only builder for now) 2019-04-19 01:26:45 +00:00
utils_test.go cli-plugins: alias an existing allowed command (only builder for now) 2019-04-19 01:26:45 +00:00