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)
return
;;
--type)
COMPREPLY=( $( compgen -W "image container" -- "$cur" ) )
return
;;
esac
case "$cur" in
-*)
COMPREPLY=( $( compgen -W "--format -f --help" -- "$cur" ) )
COMPREPLY=( $( compgen -W "--format -f --type --help" -- "$cur" ) )
;;
*)
__docker_containers_and_images

View File

@ -17,6 +17,9 @@ weight=1
-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
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*]]
[**--type**=*container*|*image*]
CONTAINER|IMAGE [CONTAINER|IMAGE...]
# DESCRIPTION
@ -24,14 +25,29 @@ each result.
**-f**, **--format**=""
Format the output using the given go template.
**--type**=*container*|*image*
Return JSON for specified type, permissible values are "image" or "container"
# 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
To get information on a container use its ID or instance name:
$ docker inspect d2cc496561d6
[{
[{
"Id": "d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
"Created": "2015-06-08T16:18:02.505155285Z",
"Path": "bash",
@ -161,8 +177,8 @@ To get information on a container use its ID or instance name:
"CpuShares": 0,
"Cpuset": ""
}
}
]
}
]
## Getting the IP address of a container instance
To get the IP address of a container use:
@ -188,7 +204,7 @@ Use an image's ID or name (e.g., repository/name[:tag]) to get information
on it.
$ docker inspect ded7cd95e059
[{
[{
"Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
"Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
"Comment": "",
@ -258,8 +274,8 @@ on it.
"DeviceSize": "171798691840"
}
}
}
]
}
]
# HISTORY
April 2014, originally compiled by William Henry (whenry at redhat dot com)