diff --git a/man/src/container/ls.md b/man/src/container/ls.md index 93a87efcab..2bbef0c16e 100644 --- a/man/src/container/ls.md +++ b/man/src/container/ls.md @@ -115,3 +115,8 @@ Valid placeholders for the Go template are listed below: $ 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: + + $ 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"} diff --git a/man/src/container/stats.md b/man/src/container/stats.md index 2de672ee2e..f824417ff2 100644 --- a/man/src/container/stats.md +++ b/man/src/container/stats.md @@ -2,7 +2,7 @@ Display a live stream of one or more containers' resource usage statistics # Format - Pretty-print containers statistics using a Go template. + Format the output using the given Go template. Valid placeholders: .Container - Container name or ID. .Name - Container name. @@ -41,3 +41,8 @@ Running `docker container stats` with customized format on all (Running and Stop 5a8b07ec4cc52823f3cbfdb964018623c1ba307bce2c057ccdbde5f4f6990833 big_heisenberg 0.00% 0B / 0B `drunk_visvesvaraya` and `big_heisenberg` are stopped containers in the above example. + +Running `docker container stats` in JSON format. + + $ docker container stats --format json + {"BlockIO":"43.9MB / 0B","CPUPerc":"0.00%","Container":"14c505d03da8","ID":"14c505d03da8","MemPerc":"0.21%","MemUsage":"4.242MiB / 1.944GiB","Name":"registry","NetIO":"4.17kB / 0B","PIDs":"13"} \ No newline at end of file diff --git a/man/src/image/ls.md b/man/src/image/ls.md index 7e32749911..cf15937e06 100644 --- a/man/src/image/ls.md +++ b/man/src/image/ls.md @@ -25,7 +25,7 @@ Filters the output based on these conditions: ## Format - Pretty-print images using a Go template. + Format the output using the given Go template. Valid placeholders: .ID - Image ID .Repository - Image repository @@ -78,12 +78,13 @@ still find it in the third-party dockviz tool: https://github.com/justone/dockvi When using the --format option, the image command will either output the data exactly as the template declares or, when using the `table` directive, will include column headers as well. You can use special characters like `\t` for -inserting tab spacing between columns. +inserting tab spacing between columns. The `json` directive outputs objects +in JSON format. The following example uses a template without headers and outputs the ID and Repository entries separated by a colon for all images: - docker images --format "{{.ID}}: {{.Repository}}" + docker image ls --format "{{.ID}}: {{.Repository}}" 77af4d6b9913: b6fa739cedf5: committ 78a85c484bad: ipbabble @@ -96,7 +97,7 @@ Repository entries separated by a colon for all images: To list all images with their repository and tag in a table format you can use: - docker images --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}" + docker image ls --format "table {{.ID}}\t{{.Repository}}\t{{.Tag}}" IMAGE ID REPOSITORY TAG 77af4d6b9913 b6fa739cedf5 committ latest @@ -110,6 +111,13 @@ To list all images with their repository and tag in a table format you can use: Valid template placeholders are listed above. +To list all images in JSON format you can use: + + docker image ls --format json + {"Containers":"N/A","CreatedAt":"2021-01-18 11:29:06 +0100 CET","CreatedSince":"24 hours ago","Digest":"\u003cnone\u003e","ID":"fbcf509fa16f","Repository":"docker","SharedSize":"N/A","Size":"235MB","Tag":"stable-dind","UniqueSize":"N/A","VirtualSize":"235.5MB"} + {"Containers":"N/A","CreatedAt":"2021-01-18 11:24:48 +0100 CET","CreatedSince":"24 hours ago","Digest":"\u003cnone\u003e","ID":"08656a69ab2b","Repository":"docker-cli-e2e","SharedSize":"N/A","Size":"1.21GB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"1.207GB"} + {"Containers":"N/A","CreatedAt":"2021-01-18 10:43:44 +0100 CET","CreatedSince":"24 hours ago","Digest":"\u003cnone\u003e","ID":"abca5c07c1ba","Repository":"docker-cli-dev","SharedSize":"N/A","Size":"608MB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"607.8MB"} + ## Listing only the shortened image IDs Listing just the shortened image IDs. This can be useful for some automated diff --git a/man/src/plugin/ls.md b/man/src/plugin/ls.md index f9f3945244..23b0659b5b 100644 --- a/man/src/plugin/ls.md +++ b/man/src/plugin/ls.md @@ -10,7 +10,7 @@ Filter output based on these conditions: ## Format - Pretty-print plugins using a Go template. + Format the output using the given Go template. Valid placeholders: .ID - Plugin ID. .Name - Plugin Name. @@ -30,6 +30,11 @@ Filter output based on these conditions: $ docker plugin ls --format "{{.ID}}: {{.Name}}" 869080b57404: tiborvass/sample-volume-plugin:latest +## Display plugins in JSON format + + $ docker plugin ls --format json + {"Description":"A sample volume plugin for Docker","Enabled":true,"ID":"2788a2da7e12","Name":"tiborvass/sample-volume-plugin:latest","PluginReference":"docker.io/tiborvass/sample-volume-plugin:latest"} + ## Display enabled plugins $ docker plugin ls --filter enabled=true