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 -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"

View File

@ -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

View File

@ -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.

View File

@ -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