2014-04-16 14:07:55 -04:00
|
|
|
% DOCKER(1) Docker User Manuals
|
2014-06-30 22:58:04 -04:00
|
|
|
% Docker Community
|
|
|
|
% JUNE 2014
|
2014-04-16 14:07:55 -04:00
|
|
|
# NAME
|
2014-06-30 22:58:04 -04:00
|
|
|
docker-inspect - Return low-level information on a container or image
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# SYNOPSIS
|
2014-06-30 22:58:04 -04:00
|
|
|
**docker inspect**
|
2014-10-15 17:14:12 -04:00
|
|
|
[**--help**]
|
2014-06-30 22:58:04 -04:00
|
|
|
[**-f**|**--format**[=*FORMAT*]]
|
2015-09-25 08:49:02 -04:00
|
|
|
[**-s**|**--size**[=*false*]]
|
2015-06-26 10:47:31 -04:00
|
|
|
[**--type**=*container*|*image*]
|
2014-06-30 22:58:04 -04:00
|
|
|
CONTAINER|IMAGE [CONTAINER|IMAGE...]
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
This displays all the information available in Docker for a given
|
|
|
|
container or image. 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.
|
|
|
|
|
|
|
|
# OPTIONS
|
2014-10-15 17:14:12 -04:00
|
|
|
**--help**
|
2015-04-16 21:25:06 -04:00
|
|
|
Print usage statement
|
2014-10-15 17:14:12 -04:00
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
**-f**, **--format**=""
|
2015-08-18 07:47:54 -04:00
|
|
|
Format the output using the given Go template.
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-09-25 08:49:02 -04:00
|
|
|
**-s**, **--size**=false
|
|
|
|
Display total file sizes if the type is container.
|
|
|
|
|
2015-06-26 10:47:31 -04:00
|
|
|
**--type**=*container*|*image*
|
|
|
|
Return JSON for specified type, permissible values are "image" or "container"
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
# EXAMPLES
|
|
|
|
|
2015-10-13 11:12:30 -04:00
|
|
|
Get information about an image when image name conflicts with the container name,
|
|
|
|
e.g. both image and container are named rhel7:
|
2015-06-26 10:47:31 -04:00
|
|
|
|
|
|
|
$ docker inspect --type=image rhel7
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"Id": "fe01a428b9d9de35d29531e9994157978e8c48fa693e1bf1d221dffbbb67b170",
|
|
|
|
"Parent": "10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2",
|
|
|
|
....
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
## Getting information on a container
|
|
|
|
|
2015-04-16 21:25:06 -04:00
|
|
|
To get information on a container use its ID or instance name:
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-06-15 14:05:10 -04:00
|
|
|
$ docker inspect d2cc496561d6
|
2015-06-26 10:47:31 -04:00
|
|
|
[{
|
2015-06-15 14:05:10 -04:00
|
|
|
"Id": "d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
|
|
|
|
"Created": "2015-06-08T16:18:02.505155285Z",
|
|
|
|
"Path": "bash",
|
|
|
|
"Args": [],
|
|
|
|
"State": {
|
|
|
|
"Running": false,
|
|
|
|
"Paused": false,
|
|
|
|
"Restarting": false,
|
|
|
|
"OOMKilled": false,
|
|
|
|
"Dead": false,
|
|
|
|
"Pid": 0,
|
|
|
|
"ExitCode": 0,
|
|
|
|
"Error": "",
|
|
|
|
"StartedAt": "2015-06-08T16:18:03.643865954Z",
|
|
|
|
"FinishedAt": "2015-06-08T16:57:06.448552862Z"
|
|
|
|
},
|
|
|
|
"Image": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
|
|
|
|
"NetworkSettings": {
|
|
|
|
"Bridge": "",
|
|
|
|
"EndpointID": "",
|
|
|
|
"Gateway": "",
|
|
|
|
"GlobalIPv6Address": "",
|
|
|
|
"GlobalIPv6PrefixLen": 0,
|
|
|
|
"HairpinMode": false,
|
|
|
|
"IPAddress": "",
|
|
|
|
"IPPrefixLen": 0,
|
|
|
|
"IPv6Gateway": "",
|
|
|
|
"LinkLocalIPv6Address": "",
|
|
|
|
"LinkLocalIPv6PrefixLen": 0,
|
|
|
|
"MacAddress": "",
|
|
|
|
"NetworkID": "",
|
|
|
|
"Ports": null,
|
|
|
|
"SandboxKey": "",
|
|
|
|
"SecondaryIPAddresses": null,
|
|
|
|
"SecondaryIPv6Addresses": null
|
|
|
|
},
|
|
|
|
"ResolvConfPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/resolv.conf",
|
|
|
|
"HostnamePath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hostname",
|
|
|
|
"HostsPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hosts",
|
|
|
|
"LogPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47-json.log",
|
|
|
|
"Name": "/adoring_wozniak",
|
|
|
|
"RestartCount": 0,
|
|
|
|
"Driver": "devicemapper",
|
|
|
|
"ExecDriver": "native-0.2",
|
|
|
|
"MountLabel": "",
|
|
|
|
"ProcessLabel": "",
|
2015-06-03 15:21:38 -04:00
|
|
|
"Mounts": [
|
|
|
|
{
|
|
|
|
"Source": "/data",
|
|
|
|
"Destination": "/data",
|
|
|
|
"Mode": "ro,Z",
|
|
|
|
"RW": false
|
|
|
|
}
|
|
|
|
],
|
2015-06-15 14:05:10 -04:00
|
|
|
"AppArmorProfile": "",
|
|
|
|
"ExecIDs": null,
|
|
|
|
"HostConfig": {
|
|
|
|
"Binds": null,
|
|
|
|
"ContainerIDFile": "",
|
|
|
|
"LxcConf": [],
|
|
|
|
"Memory": 0,
|
|
|
|
"MemorySwap": 0,
|
|
|
|
"CpuShares": 0,
|
|
|
|
"CpuPeriod": 0,
|
|
|
|
"CpusetCpus": "",
|
|
|
|
"CpusetMems": "",
|
|
|
|
"CpuQuota": 0,
|
|
|
|
"BlkioWeight": 0,
|
|
|
|
"OomKillDisable": false,
|
|
|
|
"Privileged": false,
|
|
|
|
"PortBindings": {},
|
|
|
|
"Links": null,
|
|
|
|
"PublishAllPorts": false,
|
|
|
|
"Dns": null,
|
|
|
|
"DnsSearch": null,
|
2015-08-31 14:47:25 -04:00
|
|
|
"DnsOptions": null,
|
2015-06-15 14:05:10 -04:00
|
|
|
"ExtraHosts": null,
|
|
|
|
"VolumesFrom": null,
|
|
|
|
"Devices": [],
|
|
|
|
"NetworkMode": "bridge",
|
|
|
|
"IpcMode": "",
|
|
|
|
"PidMode": "",
|
|
|
|
"UTSMode": "",
|
|
|
|
"CapAdd": null,
|
|
|
|
"CapDrop": null,
|
|
|
|
"RestartPolicy": {
|
|
|
|
"Name": "no",
|
|
|
|
"MaximumRetryCount": 0
|
2014-04-16 14:07:55 -04:00
|
|
|
},
|
2015-06-15 14:05:10 -04:00
|
|
|
"SecurityOpt": null,
|
|
|
|
"ReadonlyRootfs": false,
|
|
|
|
"Ulimits": null,
|
|
|
|
"LogConfig": {
|
|
|
|
"Type": "json-file",
|
|
|
|
"Config": {}
|
2015-04-16 21:25:06 -04:00
|
|
|
},
|
2015-06-15 14:05:10 -04:00
|
|
|
"CgroupParent": ""
|
|
|
|
},
|
|
|
|
"GraphDriver": {
|
|
|
|
"Name": "devicemapper",
|
|
|
|
"Data": {
|
|
|
|
"DeviceId": "5",
|
|
|
|
"DeviceName": "docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
|
|
|
|
"DeviceSize": "171798691840"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"Config": {
|
|
|
|
"Hostname": "d2cc496561d6",
|
|
|
|
"Domainname": "",
|
|
|
|
"User": "",
|
|
|
|
"AttachStdin": true,
|
|
|
|
"AttachStdout": true,
|
|
|
|
"AttachStderr": true,
|
|
|
|
"ExposedPorts": null,
|
|
|
|
"Tty": true,
|
|
|
|
"OpenStdin": true,
|
|
|
|
"StdinOnce": true,
|
|
|
|
"Env": null,
|
|
|
|
"Cmd": [
|
|
|
|
"bash"
|
|
|
|
],
|
|
|
|
"Image": "fedora",
|
|
|
|
"Volumes": null,
|
|
|
|
"VolumeDriver": "",
|
|
|
|
"WorkingDir": "",
|
|
|
|
"Entrypoint": null,
|
|
|
|
"NetworkDisabled": false,
|
|
|
|
"MacAddress": "",
|
|
|
|
"OnBuild": null,
|
|
|
|
"Labels": {},
|
|
|
|
"Memory": 0,
|
|
|
|
"MemorySwap": 0,
|
|
|
|
"CpuShares": 0,
|
2015-08-04 16:51:48 -04:00
|
|
|
"Cpuset": "",
|
2015-08-18 13:30:44 -04:00
|
|
|
"StopSignal": "SIGTERM"
|
2015-04-16 21:25:06 -04:00
|
|
|
}
|
2015-06-26 10:47:31 -04:00
|
|
|
}
|
|
|
|
]
|
2014-04-16 14:07:55 -04:00
|
|
|
## Getting the IP address of a container instance
|
|
|
|
|
|
|
|
To get the IP address of a container use:
|
|
|
|
|
2015-09-30 16:11:36 -04:00
|
|
|
$ docker inspect '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' d2cc496561d6
|
2014-04-16 14:07:55 -04:00
|
|
|
172.17.0.2
|
|
|
|
|
|
|
|
## Listing all port bindings
|
|
|
|
|
|
|
|
One can loop over arrays and maps in the results to produce simple text
|
|
|
|
output:
|
|
|
|
|
2015-04-16 21:25:06 -04:00
|
|
|
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
|
2015-06-15 14:05:10 -04:00
|
|
|
{{$p}} -> {{(index $conf 0).HostPort}} {{end}}' d2cc496561d6
|
2015-04-16 21:25:06 -04:00
|
|
|
80/tcp -> 80
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-08-18 07:47:54 -04:00
|
|
|
You can get more information about how to write a Go template from:
|
|
|
|
https://golang.org/pkg/text/template/.
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-09-25 08:49:02 -04:00
|
|
|
## Getting size information on an container
|
|
|
|
|
|
|
|
$ docker inspect -s d2cc496561d6
|
|
|
|
[
|
|
|
|
{
|
|
|
|
....
|
|
|
|
"SizeRw": 0,
|
|
|
|
"SizeRootFs": 972,
|
|
|
|
....
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2014-04-16 14:07:55 -04:00
|
|
|
## Getting information on an image
|
|
|
|
|
2014-06-29 21:31:15 -04:00
|
|
|
Use an image's ID or name (e.g., repository/name[:tag]) to get information
|
2015-10-13 11:12:30 -04:00
|
|
|
about the image:
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-06-15 14:05:10 -04:00
|
|
|
$ docker inspect ded7cd95e059
|
2015-06-26 10:47:31 -04:00
|
|
|
[{
|
2015-06-15 14:05:10 -04:00
|
|
|
"Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
|
|
|
|
"Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
|
|
|
|
"Comment": "",
|
|
|
|
"Created": "2015-05-27T16:58:22.937503085Z",
|
|
|
|
"Container": "76cf7f67d83a7a047454b33007d03e32a8f474ad332c3a03c94537edd22b312b",
|
|
|
|
"ContainerConfig": {
|
|
|
|
"Hostname": "76cf7f67d83a",
|
|
|
|
"Domainname": "",
|
|
|
|
"User": "",
|
|
|
|
"AttachStdin": false,
|
|
|
|
"AttachStdout": false,
|
|
|
|
"AttachStderr": false,
|
|
|
|
"ExposedPorts": null,
|
|
|
|
"Tty": false,
|
|
|
|
"OpenStdin": false,
|
|
|
|
"StdinOnce": false,
|
|
|
|
"Env": null,
|
|
|
|
"Cmd": [
|
|
|
|
"/bin/sh",
|
|
|
|
"-c",
|
|
|
|
"#(nop) ADD file:4be46382bcf2b095fcb9fe8334206b584eff60bb3fad8178cbd97697fcb2ea83 in /"
|
|
|
|
],
|
|
|
|
"Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
|
|
|
|
"Volumes": null,
|
|
|
|
"VolumeDriver": "",
|
|
|
|
"WorkingDir": "",
|
|
|
|
"Entrypoint": null,
|
|
|
|
"NetworkDisabled": false,
|
|
|
|
"MacAddress": "",
|
|
|
|
"OnBuild": null,
|
|
|
|
"Labels": {}
|
|
|
|
},
|
|
|
|
"DockerVersion": "1.6.0",
|
|
|
|
"Author": "Lokesh Mandvekar \u003clsm5@fedoraproject.org\u003e",
|
|
|
|
"Config": {
|
|
|
|
"Hostname": "76cf7f67d83a",
|
|
|
|
"Domainname": "",
|
|
|
|
"User": "",
|
|
|
|
"AttachStdin": false,
|
|
|
|
"AttachStdout": false,
|
|
|
|
"AttachStderr": false,
|
|
|
|
"ExposedPorts": null,
|
|
|
|
"Tty": false,
|
|
|
|
"OpenStdin": false,
|
|
|
|
"StdinOnce": false,
|
|
|
|
"Env": null,
|
|
|
|
"Cmd": null,
|
|
|
|
"Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
|
|
|
|
"Volumes": null,
|
|
|
|
"VolumeDriver": "",
|
|
|
|
"WorkingDir": "",
|
|
|
|
"Entrypoint": null,
|
|
|
|
"NetworkDisabled": false,
|
|
|
|
"MacAddress": "",
|
|
|
|
"OnBuild": null,
|
|
|
|
"Labels": {}
|
|
|
|
},
|
|
|
|
"Architecture": "amd64",
|
|
|
|
"Os": "linux",
|
|
|
|
"Size": 186507296,
|
|
|
|
"VirtualSize": 186507296,
|
|
|
|
"GraphDriver": {
|
|
|
|
"Name": "devicemapper",
|
|
|
|
"Data": {
|
|
|
|
"DeviceId": "3",
|
|
|
|
"DeviceName": "docker-253:1-2763198-ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
|
|
|
|
"DeviceSize": "171798691840"
|
|
|
|
}
|
|
|
|
}
|
2015-06-26 10:47:31 -04:00
|
|
|
}
|
|
|
|
]
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# HISTORY
|
2015-04-16 21:25:06 -04:00
|
|
|
April 2014, originally compiled by William Henry (whenry at redhat dot com)
|
2014-07-01 20:30:25 -04:00
|
|
|
based on docker.com source material and internal work.
|
2014-06-30 22:58:04 -04:00
|
|
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
2015-04-16 21:25:06 -04:00
|
|
|
April 2015, updated by Qiang Huang <h.huangqiang@huawei.com>
|
2015-10-13 11:12:30 -04:00
|
|
|
October 2015, updated by Sally O'Malley <somalley@redhat.com>
|