From de3e44577ac5d5836adabcb88baa56a7a3bede9d Mon Sep 17 00:00:00 2001 From: Zhang Kun Date: Fri, 25 Sep 2015 20:49:02 +0800 Subject: [PATCH] add size to inspect Signed-off-by: Zhang Kun --- contrib/completion/fish/docker.fish | 1 + contrib/completion/zsh/_docker | 1 + docs/reference/commandline/inspect.md | 1 + man/docker-inspect.1.md | 16 ++++++++++++++++ 4 files changed, 19 insertions(+) diff --git a/contrib/completion/fish/docker.fish b/contrib/completion/fish/docker.fish index b59ba64625..028c4822fd 100644 --- a/contrib/completion/fish/docker.fish +++ b/contrib/completion/fish/docker.fish @@ -207,6 +207,7 @@ complete -c docker -f -n '__fish_docker_no_subcommand' -a info -d 'Display syste complete -c docker -f -n '__fish_docker_no_subcommand' -a inspect -d 'Return low-level information on a container or image' complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -s f -l format -d 'Format the output using the given go template.' complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -l help -d 'Print usage' +complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -s s -l size -d 'Display total file sizes if the type is container.' complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_images)' -d "Image" complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_containers all)' -d "Container" diff --git a/contrib/completion/zsh/_docker b/contrib/completion/zsh/_docker index 4ee3771200..cd1d667897 100644 --- a/contrib/completion/zsh/_docker +++ b/contrib/completion/zsh/_docker @@ -650,6 +650,7 @@ __docker_subcommand() { _arguments \ $opts_help \ "($help -f --format=-)"{-f,--format=-}"[Format the output using the given go template]:template: " \ + "($help -s --size)"{-s,--size}"[Display total file sizes if the type is container]" \ "($help)--type=-[Return JSON for specified type]:type:(image container)" \ "($help -)*: :->values" && ret=0 diff --git a/docs/reference/commandline/inspect.md b/docs/reference/commandline/inspect.md index 998e198fe7..e9aea381ff 100644 --- a/docs/reference/commandline/inspect.md +++ b/docs/reference/commandline/inspect.md @@ -18,6 +18,7 @@ parent = "smn_cli" --help=false Print usage --type=container|image Return JSON for specified type, permissible values are "image" or "container" + -s, --size=false Display total file sizes if the type is container By default, this will render all results in a JSON array. If a format is specified, the given template will be executed for each result. diff --git a/man/docker-inspect.1.md b/man/docker-inspect.1.md index 18961a86f2..82a7907d22 100644 --- a/man/docker-inspect.1.md +++ b/man/docker-inspect.1.md @@ -8,6 +8,7 @@ docker-inspect - Return low-level information on a container or image **docker inspect** [**--help**] [**-f**|**--format**[=*FORMAT*]] +[**-s**|**--size**[=*false*]] [**--type**=*container*|*image*] CONTAINER|IMAGE [CONTAINER|IMAGE...] @@ -25,6 +26,9 @@ each result. **-f**, **--format**="" Format the output using the given Go template. +**-s**, **--size**=false + Display total file sizes if the type is container. + **--type**=*container*|*image* Return JSON for specified type, permissible values are "image" or "container" @@ -205,6 +209,18 @@ output: You can get more information about how to write a Go template from: https://golang.org/pkg/text/template/. +## Getting size information on an container + + $ docker inspect -s d2cc496561d6 + [ + { + .... + "SizeRw": 0, + "SizeRootFs": 972, + .... + } + ] + ## Getting information on an image Use an image's ID or name (e.g., repository/name[:tag]) to get information