Flag Addition: --type flag added for docker inspect command

Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
This commit is contained in:
Shishir Mahajan 2015-06-26 10:47:31 -04:00 committed by Tibor Vass
parent 7cd538db6f
commit 24e7d40f42
3 changed files with 31 additions and 7 deletions

View File

@ -527,11 +527,16 @@ _docker_inspect() {
--format|-f) --format|-f)
return return
;; ;;
--type)
COMPREPLY=( $( compgen -W "image container" -- "$cur" ) )
return
;;
esac esac
case "$cur" in case "$cur" in
-*) -*)
COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) ) COMPREPLY=( $( compgen -W "--format -f --type --help" -- "$cur" ) )
;; ;;
*) *)
__docker_containers_and_images __docker_containers_and_images

View File

@ -17,6 +17,9 @@ weight=1
-f, --format="" Format the output using the given go template -f, --format="" Format the output using the given go template
--type=container|image Return JSON for specified type, permissible
values are "image" or "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*]]
[**--type**=*container*|*image*]
CONTAINER|IMAGE [CONTAINER|IMAGE...] CONTAINER|IMAGE [CONTAINER|IMAGE...]
# DESCRIPTION # DESCRIPTION
@ -24,8 +25,23 @@ each result.
**-f**, **--format**="" **-f**, **--format**=""
Format the output using the given go template. Format the output using the given go template.
**--type**=*container*|*image*
Return JSON for specified type, permissible values are "image" or "container"
# EXAMPLES # EXAMPLES
Getting information on an image where image name conflict with the container name,
e,g both image and container are named rhel7.
$ docker inspect --type=image rhel7
[
{
"Id": "fe01a428b9d9de35d29531e9994157978e8c48fa693e1bf1d221dffbbb67b170",
"Parent": "10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2",
....
}
]
## Getting information on a container ## Getting information on a container
To get information on a container use its ID or instance name: To get information on a container use its ID or instance name: