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*]]
|
|
|
|
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-04-16 21:25:06 -04:00
|
|
|
Format the output using the given go template.
|
2014-04-16 14:07:55 -04:00
|
|
|
|
|
|
|
# EXAMPLES
|
|
|
|
|
|
|
|
## 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-04-16 21:25:06 -04:00
|
|
|
$ docker inspect 1eb5fabf5a03
|
2014-04-16 14:07:55 -04:00
|
|
|
[{
|
2015-04-16 21:25:06 -04:00
|
|
|
"AppArmorProfile": "",
|
|
|
|
"Args": [],
|
|
|
|
"Config": {
|
|
|
|
"AttachStderr": false,
|
2014-04-16 14:07:55 -04:00
|
|
|
"AttachStdin": false,
|
|
|
|
"AttachStdout": false,
|
|
|
|
"Cmd": [
|
|
|
|
"/usr/sbin/nginx"
|
|
|
|
],
|
2015-04-16 21:25:06 -04:00
|
|
|
"Domainname": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
"Entrypoint": null,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Env": [
|
|
|
|
"HOME=/",
|
|
|
|
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
|
|
],
|
|
|
|
"ExposedPorts": {
|
|
|
|
"80/tcp": {}
|
|
|
|
},
|
|
|
|
"Hostname": "1eb5fabf5a03",
|
|
|
|
"Image": "summit/nginx",
|
|
|
|
"Labels": {
|
|
|
|
"com.example.vendor": "Acme",
|
|
|
|
"com.example.license": "GPL",
|
|
|
|
"com.example.version": "1.0"
|
|
|
|
},
|
|
|
|
"MacAddress": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
"NetworkDisabled": false,
|
|
|
|
"OnBuild": null,
|
2015-04-16 21:25:06 -04:00
|
|
|
"OpenStdin": false,
|
|
|
|
"StdinOnce": false,
|
|
|
|
"Tty": true,
|
|
|
|
"User": "",
|
|
|
|
"Volumes": null,
|
|
|
|
"WorkingDir": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
},
|
2015-04-16 21:25:06 -04:00
|
|
|
"Created": "2014-04-04T21:33:52.02361335Z",
|
|
|
|
"Driver": "devicemapper",
|
|
|
|
"ExecDriver": "native-0.1",
|
|
|
|
"ExecIDs": null,
|
|
|
|
"HostConfig": {
|
|
|
|
"Binds": null,
|
|
|
|
"CapAdd": null,
|
|
|
|
"CapDrop": null,
|
|
|
|
"CgroupParent": "",
|
|
|
|
"ContainerIDFile": "",
|
|
|
|
"CpuShares": 512,
|
|
|
|
"CpusetCpus": "0,1",
|
|
|
|
"CpusetMems": "",
|
|
|
|
"Devices": [],
|
|
|
|
"Dns": null,
|
|
|
|
"DnsSearch": null,
|
|
|
|
"ExtraHosts": null,
|
|
|
|
"IpcMode": "",
|
|
|
|
"Links": null,
|
|
|
|
"LogConfig": {
|
|
|
|
"Config": null,
|
|
|
|
"Type": "json-file"
|
|
|
|
},
|
|
|
|
"LxcConf": null,
|
|
|
|
"Memory": 16777216,
|
|
|
|
"MemorySwap": -1,
|
|
|
|
"NetworkMode": "",
|
|
|
|
"PidMode": "",
|
|
|
|
"PortBindings": {
|
|
|
|
"80/tcp": [
|
|
|
|
{
|
|
|
|
"HostIp": "0.0.0.0",
|
|
|
|
"HostPort": "80"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"Privileged": false,
|
|
|
|
"PublishAllPorts": false,
|
|
|
|
"ReadonlyRootfs": false,
|
|
|
|
"RestartPolicy": {
|
|
|
|
"MaximumRetryCount": 0,
|
|
|
|
"Name": ""
|
|
|
|
},
|
|
|
|
"SecurityOpt": null,
|
|
|
|
"Ulimits": null,
|
|
|
|
"VolumesFrom": null
|
|
|
|
}
|
|
|
|
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
|
|
|
|
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
|
|
|
|
"ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
|
2014-04-16 14:07:55 -04:00
|
|
|
"Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
|
2015-04-16 21:25:06 -04:00
|
|
|
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
|
|
|
"MountLabel": "",
|
|
|
|
"Name": "/ecstatic_ptolemy",
|
2014-04-16 14:07:55 -04:00
|
|
|
"NetworkSettings": {
|
2015-04-16 21:25:06 -04:00
|
|
|
"Bridge": "docker0",
|
|
|
|
"Gateway": "172.17.42.1",
|
|
|
|
"GlobalIPv6Address": "",
|
|
|
|
"GlobalIPv6PrefixLen": 0,
|
2014-04-16 14:07:55 -04:00
|
|
|
"IPAddress": "172.17.0.2",
|
|
|
|
"IPPrefixLen": 16,
|
2015-04-16 21:25:06 -04:00
|
|
|
"IPv6Gateway": "",
|
|
|
|
"LinkLocalIPv6Address": "",
|
|
|
|
"LinkLocalIPv6PrefixLen": 0,
|
|
|
|
"MacAddress": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
"PortMapping": null,
|
|
|
|
"Ports": {
|
|
|
|
"80/tcp": [
|
|
|
|
{
|
|
|
|
"HostIp": "0.0.0.0",
|
|
|
|
"HostPort": "80"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
2015-04-16 21:25:06 -04:00
|
|
|
"Path": "/usr/sbin/nginx",
|
|
|
|
"ProcessLabel": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
"ResolvConfPath": "/etc/resolv.conf",
|
2015-04-16 21:25:06 -04:00
|
|
|
"RestartCount": 0,
|
|
|
|
"State": {
|
|
|
|
"Dead": false,
|
|
|
|
"Error": "",
|
|
|
|
"ExitCode": 0,
|
|
|
|
"FinishedAt": "0001-01-01T00:00:00Z",
|
|
|
|
"OOMKilled": false,
|
|
|
|
"Paused": false,
|
|
|
|
"Pid": 858,
|
|
|
|
"Restarting": false,
|
|
|
|
"Running": true,
|
|
|
|
"StartedAt": "2014-04-04T21:33:54.16259207Z",
|
|
|
|
},
|
2014-04-16 14:07:55 -04:00
|
|
|
"Volumes": {},
|
|
|
|
"VolumesRW": {},
|
2015-04-16 21:25:06 -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-04-16 21:25:06 -04:00
|
|
|
$ docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
|
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}} \
|
|
|
|
{{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
|
|
|
|
80/tcp -> 80
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-04-16 21:25:06 -04:00
|
|
|
You can get more information about how to write a go template from:
|
|
|
|
http://golang.org/pkg/text/template/.
|
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-04-16 21:25:06 -04:00
|
|
|
on it.
|
2014-04-16 14:07:55 -04:00
|
|
|
|
2015-04-16 21:25:06 -04:00
|
|
|
$ docker inspect fc1203419df2
|
2014-04-16 14:07:55 -04:00
|
|
|
[{
|
2015-04-16 21:25:06 -04:00
|
|
|
"Architecture": "amd64",
|
|
|
|
"Author": "",
|
|
|
|
"Comment": "",
|
|
|
|
"Config": {
|
|
|
|
"AttachStderr": false,
|
2014-04-16 14:07:55 -04:00
|
|
|
"AttachStdin": false,
|
|
|
|
"AttachStdout": false,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Cmd": [
|
|
|
|
"make",
|
|
|
|
"direct-test"
|
|
|
|
],
|
|
|
|
"Domainname": "",
|
|
|
|
"Entrypoint": [
|
|
|
|
"/dind"
|
|
|
|
],
|
|
|
|
"Env": [
|
|
|
|
"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
|
|
],
|
2014-04-16 14:07:55 -04:00
|
|
|
"ExposedPorts": null,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Hostname": "242978536a06",
|
|
|
|
"Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
|
|
|
"Labels": {},
|
|
|
|
"MacAddress": "",
|
|
|
|
"NetworkDisabled": false,
|
|
|
|
"OnBuild": [],
|
2014-04-16 14:07:55 -04:00
|
|
|
"OpenStdin": false,
|
|
|
|
"StdinOnce": false,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Tty": false,
|
|
|
|
"User": "",
|
|
|
|
"Volumes": null,
|
|
|
|
"WorkingDir": "/go/src/github.com/docker/libcontainer"
|
|
|
|
},
|
|
|
|
"Container": "1c00417f3812a96d3ebc29e7fdee69f3d586d703ab89c8233fd4678d50707b39",
|
|
|
|
"ContainerConfig": {
|
|
|
|
"AttachStderr": false,
|
|
|
|
"AttachStdin": false,
|
|
|
|
"AttachStdout": false,
|
2014-04-16 14:07:55 -04:00
|
|
|
"Cmd": [
|
|
|
|
"/bin/sh",
|
|
|
|
"-c",
|
2015-04-16 21:25:06 -04:00
|
|
|
"#(nop) CMD [\"make\" \"direct-test\"]"
|
2014-04-16 14:07:55 -04:00
|
|
|
],
|
|
|
|
"Domainname": "",
|
2015-04-16 21:25:06 -04:00
|
|
|
"Entrypoint": [
|
|
|
|
"/dind"
|
|
|
|
],
|
|
|
|
"Env": [
|
|
|
|
"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
|
|
|
],
|
2014-04-16 14:07:55 -04:00
|
|
|
"ExposedPorts": null,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Hostname": "242978536a06",
|
|
|
|
"Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
|
|
|
"Labels": {},
|
|
|
|
"MacAddress": "",
|
|
|
|
"NetworkDisabled": false,
|
|
|
|
"OnBuild": [],
|
2014-04-16 14:07:55 -04:00
|
|
|
"OpenStdin": false,
|
|
|
|
"StdinOnce": false,
|
2015-04-16 21:25:06 -04:00
|
|
|
"Tty": false,
|
|
|
|
"User": "",
|
2014-04-16 14:07:55 -04:00
|
|
|
"Volumes": null,
|
2015-04-16 21:25:06 -04:00
|
|
|
"WorkingDir": "/go/src/github.com/docker/libcontainer"
|
2014-04-16 14:07:55 -04:00
|
|
|
},
|
2015-04-16 21:25:06 -04:00
|
|
|
"Created": "2015-04-07T05:34:39.079489206Z",
|
|
|
|
"DockerVersion": "1.5.0-dev",
|
|
|
|
"Id": "fc1203419df26ca82cad1dd04c709cb1b8a8a947bd5bcbdfbef8241a76f031db",
|
|
|
|
"Os": "linux",
|
|
|
|
"Parent": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
|
|
|
"Size": 0,
|
|
|
|
"VirtualSize": 613136466
|
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>
|