From b4af799686dca6e0a48707321d2a98dfd375a2f2 Mon Sep 17 00:00:00 2001 From: Silvin Lubecki Date: Wed, 10 Mar 2021 00:49:33 +0100 Subject: [PATCH] Update reference documentation Signed-off-by: Silvin Lubecki Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/context_ls.md | 10 +++++++--- docs/reference/commandline/images.md | 15 ++++++++++++++- docs/reference/commandline/info.md | 2 +- docs/reference/commandline/network_ls.md | 16 +++++++++++++++- docs/reference/commandline/node_ls.md | 12 +++++++++++- docs/reference/commandline/plugin_ls.md | 13 ++++++++++++- docs/reference/commandline/ps.md | 13 ++++++++++++- docs/reference/commandline/secret_ls.md | 14 +++++++++++++- docs/reference/commandline/service_ls.md | 13 ++++++++++++- docs/reference/commandline/stack_ls.md | 13 ++++++++++++- docs/reference/commandline/stack_ps.md | 15 ++++++++++++++- docs/reference/commandline/stack_services.md | 15 ++++++++++++++- docs/reference/commandline/system_df.md | 16 +++++++++++++++- docs/reference/commandline/volume_ls.md | 13 ++++++++++++- 14 files changed, 164 insertions(+), 16 deletions(-) diff --git a/docs/reference/commandline/context_ls.md b/docs/reference/commandline/context_ls.md index d691b46c7f..aec714b5d4 100644 --- a/docs/reference/commandline/context_ls.md +++ b/docs/reference/commandline/context_ls.md @@ -15,8 +15,12 @@ Aliases: ls, list Options: - --format string Pretty-print contexts using a Go template - (default "table") + --format string 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 -q, --quiet Only show context names ``` @@ -32,4 +36,4 @@ NAME DESCRIPTION DOCKER ENDPOINT default * Current DOCKER_HOST based configuration unix:///var/run/docker.sock swarm production tcp:///prod.corp.example.com:2376 staging tcp:///stage.corp.example.com:2376 -``` +``` \ No newline at end of file diff --git a/docs/reference/commandline/images.md b/docs/reference/commandline/images.md index 5577de44be..6c5882c939 100644 --- a/docs/reference/commandline/images.md +++ b/docs/reference/commandline/images.md @@ -20,7 +20,12 @@ Options: - before=([:tag]||) - since=([:tag]||) - reference=(pattern of an image reference) - --format string Pretty-print images using a Go template + --format string 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 --help Print usage --no-trunc Don't truncate output -q, --quiet Only show image IDs @@ -341,3 +346,11 @@ b6fa739cedf5 committ latest 746b819f315e postgres 9.3.5 746b819f315e postgres latest ``` + +To list all images in JSON format, use the `json` directive: + +```console +$ docker images --format json +{"Containers":"N/A","CreatedAt":"2021-03-04 03:24:42 +0100 CET","CreatedSince":"5 days ago","Digest":"\u003cnone\u003e","ID":"4dd97cefde62","Repository":"ubuntu","SharedSize":"N/A","Size":"72.9MB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"72.9MB"} +{"Containers":"N/A","CreatedAt":"2021-02-17 22:19:54 +0100 CET","CreatedSince":"2 weeks ago","Digest":"\u003cnone\u003e","ID":"28f6e2705743","Repository":"alpine","SharedSize":"N/A","Size":"5.61MB","Tag":"latest","UniqueSize":"N/A","VirtualSize":"5.613MB"} +``` \ No newline at end of file diff --git a/docs/reference/commandline/info.md b/docs/reference/commandline/info.md index 0071edd862..316e301ab6 100644 --- a/docs/reference/commandline/info.md +++ b/docs/reference/commandline/info.md @@ -12,7 +12,7 @@ Usage: docker info [OPTIONS] Display system-wide information Options: - -f, --format string Format the output using the given Go template + -f, --format string Format the output using the given Go template (default "json") --help Print usage ``` diff --git a/docs/reference/commandline/network_ls.md b/docs/reference/commandline/network_ls.md index 8b938b33be..98b43d2909 100644 --- a/docs/reference/commandline/network_ls.md +++ b/docs/reference/commandline/network_ls.md @@ -16,7 +16,12 @@ Aliases: Options: -f, --filter filter Provide filter values (e.g. 'driver=bridge') - --format string Pretty-print networks using a Go template + --format string 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 --help Print usage --no-trunc Do not truncate the output -q, --quiet Only display network IDs @@ -230,6 +235,15 @@ d1584f8dc718: host 391df270dc66: null ``` +To list all networks in JSON format, use the `json` directive: + +```console +$ docker network ls --format json +{"CreatedAt":"2021-03-09 21:41:29.798999529 +0000 UTC","Driver":"bridge","ID":"f33ba176dd8e","IPv6":"false","Internal":"false","Labels":"","Name":"bridge","Scope":"local"} +{"CreatedAt":"2021-03-09 21:41:29.772806592 +0000 UTC","Driver":"host","ID":"caf47bb3ac70","IPv6":"false","Internal":"false","Labels":"","Name":"host","Scope":"local"} +{"CreatedAt":"2021-03-09 21:41:29.752212603 +0000 UTC","Driver":"null","ID":"9d096c122066","IPv6":"false","Internal":"false","Labels":"","Name":"none","Scope":"local"} +``` + ## Related commands * [network disconnect ](network_disconnect.md) diff --git a/docs/reference/commandline/node_ls.md b/docs/reference/commandline/node_ls.md index 11e3296972..ecc7aa0afc 100644 --- a/docs/reference/commandline/node_ls.md +++ b/docs/reference/commandline/node_ls.md @@ -16,7 +16,12 @@ Aliases: Options: -f, --filter filter Filter output based on conditions provided - --format string Pretty-print nodes using a Go template + --format string 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 --help Print usage -q, --quiet Only display IDs ``` @@ -203,6 +208,11 @@ e216jshn25ckzbvmwlnh5jr3g: swarm-manager1 Ready 35o6tiywb700jesrt3dmllaza: swarm-worker1 Needs Rotation ``` +To list all nodes in JSON format, use the `json` directive: +```console +$ docker node ls --format json +{"Availability":"Active","EngineVersion":"20.10.5","Hostname":"docker-desktop","ID":"k8f4w7qtzpj5sqzclcqafw35g","ManagerStatus":"Leader","Self":true,"Status":"Ready","TLSStatus":"Ready"} +``` ## Related commands diff --git a/docs/reference/commandline/plugin_ls.md b/docs/reference/commandline/plugin_ls.md index 47a657d9d8..2ce47588c0 100644 --- a/docs/reference/commandline/plugin_ls.md +++ b/docs/reference/commandline/plugin_ls.md @@ -16,7 +16,12 @@ Aliases: Options: -f, --filter filter Provide filter values (e.g. 'enabled=true') - --format string Pretty-print plugins using a Go template + --format string 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 --help Print usage --no-trunc Don't truncate output -q, --quiet Only display plugin IDs @@ -96,6 +101,12 @@ $ docker plugin ls --format "{{.ID}}: {{.Name}}" 4be01827a72e: vieux/sshfs:latest ``` +To list all plugins in JSON format, use the `json` directive: +```console +$ docker plugin ls --format json +{"Description":"sshFS plugin for Docker","Enabled":false,"ID":"856d89febb1c","Name":"vieux/sshfs:latest","PluginReference":"docker.io/vieux/sshfs:latest"} +``` + ## Related commands * [plugin create](plugin_create.md) diff --git a/docs/reference/commandline/ps.md b/docs/reference/commandline/ps.md index 02f8e27f22..1f575d7221 100644 --- a/docs/reference/commandline/ps.md +++ b/docs/reference/commandline/ps.md @@ -30,7 +30,12 @@ Options: - since=(|) - status=(created|restarting|removing|running|paused|exited) - volume=(|) - --format string Pretty-print containers using a Go template + --format string 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 --help Print usage -n, --last int Show n last created containers (includes all states) (default -1) -l, --latest Show the latest created container (includes all states) @@ -445,3 +450,9 @@ a87ecb4f327c com.docker.swarm.node=ubuntu,com.docker.swarm.storage=ssd c1d3b0166030 com.docker.swarm.node=debian,com.docker.swarm.cpu=6 41d50ecd2f57 com.docker.swarm.node=fedora,com.docker.swarm.cpu=3,com.docker.swarm.storage=ssd ``` + +To list all running containers in JSON format, use the `json` directive: +```console +$ 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"} +``` \ No newline at end of file diff --git a/docs/reference/commandline/secret_ls.md b/docs/reference/commandline/secret_ls.md index 395af6102e..ec5b1a4348 100644 --- a/docs/reference/commandline/secret_ls.md +++ b/docs/reference/commandline/secret_ls.md @@ -16,7 +16,13 @@ Aliases: Options: -f, --filter filter Filter output based on conditions provided - --format string Pretty-print secrets using a Go template + --format string 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 + --help Print usage -q, --quiet Only display IDs ``` @@ -148,6 +154,12 @@ b6fa739cedf5 secret-2 3 hours ago 78a85c484f71 secret-3 10 days ago ``` +To list all secrets in JSON format, use the `json` directive: +```console +$ docker secret ls --format json +{"CreatedAt":"28 seconds ago","Driver":"","ID":"4y7hvwrt1u8e9uxh5ygqj7mzc","Labels":"","Name":"mysecret","UpdatedAt":"28 seconds ago"} +``` + ## Related commands * [secret create](secret_create.md) diff --git a/docs/reference/commandline/service_ls.md b/docs/reference/commandline/service_ls.md index 97f7763abe..b9bf1c1033 100644 --- a/docs/reference/commandline/service_ls.md +++ b/docs/reference/commandline/service_ls.md @@ -16,7 +16,12 @@ Aliases: Options: -f, --filter filter Filter output based on conditions provided - --format string Pretty-print services using a Go template + --format string 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 --help Print usage -q, --quiet Only display IDs ``` @@ -153,6 +158,12 @@ $ docker service ls --format "{{.ID}}: {{.Mode}} {{.Replicas}}" fm6uf97exkul: global 5/5 ``` +To list all services in JSON format, use the `json` directive: +```console +$ docker service ls --format json +{"ID":"ssniordqolsi","Image":"hello-world:latest","Mode":"replicated","Name":"hello","Ports":"","Replicas":"0/1"} +``` + ## Related commands * [service create](service_create.md) diff --git a/docs/reference/commandline/stack_ls.md b/docs/reference/commandline/stack_ls.md index 453db5f588..d6b7dccabc 100644 --- a/docs/reference/commandline/stack_ls.md +++ b/docs/reference/commandline/stack_ls.md @@ -16,7 +16,12 @@ Aliases: Options: --help Print usage - --format string Pretty-print stacks using a Go template + --format string 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 ``` ## Description @@ -68,6 +73,12 @@ web-server: 1 web-cache: 4 ``` +To list all stacks in JSON format, use the `json` directive: +```console +$ docker stack ls --format json +{"Name":"myapp","Namespace":"","Orchestrator":"Swarm","Services":"3"} +``` + ## Related commands * [stack deploy](stack_deploy.md) diff --git a/docs/reference/commandline/stack_ps.md b/docs/reference/commandline/stack_ps.md index 6328064892..0f124f9df9 100644 --- a/docs/reference/commandline/stack_ps.md +++ b/docs/reference/commandline/stack_ps.md @@ -13,7 +13,12 @@ List the tasks in the stack Options: -f, --filter filter Filter output based on conditions provided - --format string Pretty-print tasks using a Go template + --format string 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 --help Print usage --no-resolve Do not map IDs to Names --no-trunc Do not truncate output @@ -157,6 +162,14 @@ voting_vote.2: dockersamples/examplevotingapp_vote:before voting_redis.2: redis:alpine ``` +To list all tasks in JSON format, use the `json` directive: +```console +$ docker stack ps --format json myapp +{"CurrentState":"Preparing 23 seconds ago","DesiredState":"Running","Error":"","ID":"2ufjubh79tn0","Image":"localstack/localstack:latest","Name":"myapp_localstack.1","Node":"docker-desktop","Ports":""} +{"CurrentState":"Running 20 seconds ago","DesiredState":"Running","Error":"","ID":"roee387ngf5r","Image":"redis:6.0.9-alpine3.12","Name":"myapp_redis.1","Node":"docker-desktop","Ports":""} +{"CurrentState":"Preparing 13 seconds ago","DesiredState":"Running","Error":"","ID":"yte68ouq7glh","Image":"postgres:13.2-alpine","Name":"myapp_repos-db.1","Node":"docker-desktop","Ports":""} +``` + ### Do not map IDs to Names The `--no-resolve` option shows IDs for task name, without mapping IDs to Names. diff --git a/docs/reference/commandline/stack_services.md b/docs/reference/commandline/stack_services.md index 8be549c48a..ba58179c56 100644 --- a/docs/reference/commandline/stack_services.md +++ b/docs/reference/commandline/stack_services.md @@ -13,7 +13,12 @@ List the services in the stack Options: -f, --filter filter Filter output based on conditions provided - --format string Pretty-print services using a Go template + --format string 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 --help Print usage -q, --quiet Only display IDs ``` @@ -98,6 +103,14 @@ $ docker stack services --format "{{.ID}}: {{.Mode}} {{.Replicas}}" fm6uf97exkul: global 5/5 ``` +To list all services in JSON format, use the `json` directive: +```console +$ docker stack services ls --format json +{"ID":"0axqbl293vwm","Image":"localstack/localstack:latest","Mode":"replicated","Name":"myapp_localstack","Ports":"*:4566-\u003e4566/tcp, *:8080-\u003e8080/tcp","Replicas":"0/1"} +{"ID":"384xvtzigz3p","Image":"redis:6.0.9-alpine3.12","Mode":"replicated","Name":"myapp_redis","Ports":"*:6379-\u003e6379/tcp","Replicas":"1/1"} +{"ID":"hyujct8cnjkk","Image":"postgres:13.2-alpine","Mode":"replicated","Name":"myapp_repos-db","Ports":"*:5432-\u003e5432/tcp","Replicas":"0/1"} +``` + ## Related commands diff --git a/docs/reference/commandline/system_df.md b/docs/reference/commandline/system_df.md index a5f1e6d23d..fe72cc53fe 100644 --- a/docs/reference/commandline/system_df.md +++ b/docs/reference/commandline/system_df.md @@ -12,7 +12,12 @@ Usage: docker system df [OPTIONS] Show docker filesystem usage Options: - --format string Pretty-print images using a Go template + --format string 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 --help Print usage -v, --verbose Show detailed information on space usage ``` @@ -122,6 +127,15 @@ Local Volumes 150.3 MB 150.3 MB (100%) ``` +To list all information in JSON format, use the `json` directive: +```console +$ docker system df --format json +{"Active":"2","Reclaimable":"2.498GB (94%)","Size":"2.631GB","TotalCount":"6","Type":"Images"} +{"Active":"1","Reclaimable":"1.114kB (49%)","Size":"2.23kB","TotalCount":"7","Type":"Containers"} +{"Active":"0","Reclaimable":"256.5MB (100%)","Size":"256.5MB","TotalCount":"1","Type":"Local Volumes"} +{"Active":"0","Reclaimable":"158B","Size":"158B","TotalCount":"17","Type":"Build Cache"} +``` + **Note** the format option is meaningless when verbose is true. ## Related commands diff --git a/docs/reference/commandline/volume_ls.md b/docs/reference/commandline/volume_ls.md index f010cfd605..4bf7ad75e2 100644 --- a/docs/reference/commandline/volume_ls.md +++ b/docs/reference/commandline/volume_ls.md @@ -20,7 +20,12 @@ Options: - driver= a volume's driver name - label= or label== - name= a volume's name - --format string Pretty-print volumes using a Go template + --format string 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 --help Print usage -q, --quiet Only display volume names ``` @@ -182,6 +187,12 @@ vol2: local vol3: local ``` +To list all volumes in JSON format, use the `json` directive: +```console +$ docker volume ls --format json +{"Driver":"local","Labels":"","Links":"N/A","Mountpoint":"/var/lib/docker/volumes/docker-cli-dev-cache/_data","Name":"docker-cli-dev-cache","Scope":"local","Size":"N/A"} +``` + ## Related commands * [volume create](volume_create.md)