add size to inspect

Signed-off-by: Zhang Kun <zkazure@gmail.com>
This commit is contained in:
Zhang Kun 2015-09-25 20:49:02 +08:00 committed by Tibor Vass
parent d83594a46d
commit de3e44577a
4 changed files with 19 additions and 0 deletions

View File

@ -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 -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' -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' -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_images)' -d "Image"
complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_containers all)' -d "Container" complete -c docker -A -f -n '__fish_seen_subcommand_from inspect' -a '(__fish_print_docker_containers all)' -d "Container"

View File

@ -650,6 +650,7 @@ __docker_subcommand() {
_arguments \ _arguments \
$opts_help \ $opts_help \
"($help -f --format=-)"{-f,--format=-}"[Format the output using the given go template]:template: " \ "($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)--type=-[Return JSON for specified type]:type:(image container)" \
"($help -)*: :->values" && ret=0 "($help -)*: :->values" && ret=0

View File

@ -18,6 +18,7 @@ parent = "smn_cli"
--help=false Print usage --help=false Print usage
--type=container|image Return JSON for specified type, permissible --type=container|image Return JSON for specified type, permissible
values are "image" or "container" 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 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. specified, the given template will be executed for each result.

View File

@ -8,6 +8,7 @@ docker-inspect - Return low-level information on a container or image
**docker inspect** **docker inspect**
[**--help**] [**--help**]
[**-f**|**--format**[=*FORMAT*]] [**-f**|**--format**[=*FORMAT*]]
[**-s**|**--size**[=*false*]]
[**--type**=*container*|*image*] [**--type**=*container*|*image*]
CONTAINER|IMAGE [CONTAINER|IMAGE...] CONTAINER|IMAGE [CONTAINER|IMAGE...]
@ -25,6 +26,9 @@ each result.
**-f**, **--format**="" **-f**, **--format**=""
Format the output using the given Go template. Format the output using the given Go template.
**-s**, **--size**=false
Display total file sizes if the type is container.
**--type**=*container*|*image* **--type**=*container*|*image*
Return JSON for specified type, permissible values are "image" or "container" 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: You can get more information about how to write a Go template from:
https://golang.org/pkg/text/template/. 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 ## Getting information on an image
Use an image's ID or name (e.g., repository/name[:tag]) to get information Use an image's ID or name (e.g., repository/name[:tag]) to get information