mirror of https://github.com/docker/docs.git
update docker-inspect man page
- sort inspect out - update output fields - format output - add doc about go template - other minor fix Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
24af878358
commit
01548ed1dc
|
@ -19,80 +19,120 @@ each result.
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
**--help**
|
**--help**
|
||||||
Print usage statement
|
Print usage statement
|
||||||
|
|
||||||
**-f**, **--format**=""
|
**-f**, **--format**=""
|
||||||
Format the output using the given go template.
|
Format the output using the given go template.
|
||||||
|
|
||||||
# EXAMPLES
|
# EXAMPLES
|
||||||
|
|
||||||
## Getting information on a container
|
## Getting information on a container
|
||||||
|
|
||||||
To get information on a container use it's ID or instance name:
|
To get information on a container use its ID or instance name:
|
||||||
|
|
||||||
#docker inspect 1eb5fabf5a03
|
$ docker inspect 1eb5fabf5a03
|
||||||
[{
|
[{
|
||||||
"ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
|
"AppArmorProfile": "",
|
||||||
"Created": "2014-04-04T21:33:52.02361335Z",
|
"Args": [],
|
||||||
"Path": "/usr/sbin/nginx",
|
"Config": {
|
||||||
"Args": [],
|
"AttachStderr": false,
|
||||||
"Config": {
|
|
||||||
"Hostname": "1eb5fabf5a03",
|
|
||||||
"Domainname": "",
|
|
||||||
"User": "",
|
|
||||||
"Memory": 0,
|
|
||||||
"MemorySwap": 0,
|
|
||||||
"CpuShares": 0,
|
|
||||||
"AttachStdin": false,
|
"AttachStdin": false,
|
||||||
"AttachStdout": false,
|
"AttachStdout": false,
|
||||||
"AttachStderr": false,
|
|
||||||
"PortSpecs": null,
|
|
||||||
"ExposedPorts": {
|
|
||||||
"80/tcp": {}
|
|
||||||
},
|
|
||||||
"Tty": true,
|
|
||||||
"OpenStdin": false,
|
|
||||||
"StdinOnce": false,
|
|
||||||
"Env": [
|
|
||||||
"HOME=/",
|
|
||||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
],
|
|
||||||
"Cmd": [
|
"Cmd": [
|
||||||
"/usr/sbin/nginx"
|
"/usr/sbin/nginx"
|
||||||
],
|
],
|
||||||
"Dns": null,
|
"Domainname": "",
|
||||||
"DnsSearch": null,
|
|
||||||
"Image": "summit/nginx",
|
|
||||||
"Volumes": null,
|
|
||||||
"VolumesFrom": "",
|
|
||||||
"WorkingDir": "",
|
|
||||||
"Entrypoint": null,
|
"Entrypoint": null,
|
||||||
|
"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": "",
|
||||||
"NetworkDisabled": false,
|
"NetworkDisabled": false,
|
||||||
"OnBuild": null,
|
"OnBuild": null,
|
||||||
"Context": {
|
"OpenStdin": false,
|
||||||
"mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650",
|
"PortSpecs": null,
|
||||||
"process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650"
|
"StdinOnce": false,
|
||||||
}
|
"Tty": true,
|
||||||
},
|
"User": "",
|
||||||
"State": {
|
"Volumes": null,
|
||||||
"Running": true,
|
"WorkingDir": "",
|
||||||
"Pid": 858,
|
|
||||||
"ExitCode": 0,
|
|
||||||
"StartedAt": "2014-04-04T21:33:54.16259207Z",
|
|
||||||
"FinishedAt": "0001-01-01T00:00:00Z",
|
|
||||||
"Ghost": false
|
|
||||||
},
|
},
|
||||||
|
"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",
|
||||||
"Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
|
"Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
|
||||||
"Labels": {
|
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
||||||
"com.example.vendor": "Acme",
|
"MountLabel": "",
|
||||||
"com.example.license": "GPL",
|
"Name": "/ecstatic_ptolemy",
|
||||||
"com.example.version": "1.0"
|
|
||||||
},
|
|
||||||
"NetworkSettings": {
|
"NetworkSettings": {
|
||||||
|
"Bridge": "docker0",
|
||||||
|
"Gateway": "172.17.42.1",
|
||||||
|
"GlobalIPv6Address": "",
|
||||||
|
"GlobalIPv6PrefixLen": 0,
|
||||||
"IPAddress": "172.17.0.2",
|
"IPAddress": "172.17.0.2",
|
||||||
"IPPrefixLen": 16,
|
"IPPrefixLen": 16,
|
||||||
"Gateway": "172.17.42.1",
|
"IPv6Gateway": "",
|
||||||
"Bridge": "docker0",
|
"LinkLocalIPv6Address": "",
|
||||||
|
"LinkLocalIPv6PrefixLen": 0,
|
||||||
|
"MacAddress": "",
|
||||||
"PortMapping": null,
|
"PortMapping": null,
|
||||||
"Ports": {
|
"Ports": {
|
||||||
"80/tcp": [
|
"80/tcp": [
|
||||||
|
@ -103,41 +143,31 @@ To get information on a container use it's ID or instance name:
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Path": "/usr/sbin/nginx",
|
||||||
|
"ProcessLabel": "",
|
||||||
"ResolvConfPath": "/etc/resolv.conf",
|
"ResolvConfPath": "/etc/resolv.conf",
|
||||||
"HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
|
"RestartCount": 0,
|
||||||
"HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
|
"State": {
|
||||||
"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
|
"Dead": false,
|
||||||
"Name": "/ecstatic_ptolemy",
|
"Error": "",
|
||||||
"Driver": "devicemapper",
|
"ExitCode": 0,
|
||||||
"ExecDriver": "native-0.1",
|
"FinishedAt": "0001-01-01T00:00:00Z",
|
||||||
|
"OOMKilled": false,
|
||||||
|
"Paused": false,
|
||||||
|
"Pid": 858,
|
||||||
|
"Restarting": false,
|
||||||
|
"Running": true,
|
||||||
|
"StartedAt": "2014-04-04T21:33:54.16259207Z",
|
||||||
|
},
|
||||||
"Volumes": {},
|
"Volumes": {},
|
||||||
"VolumesRW": {},
|
"VolumesRW": {},
|
||||||
"HostConfig": {
|
}
|
||||||
"Binds": null,
|
|
||||||
"ContainerIDFile": "",
|
|
||||||
"LxcConf": [],
|
|
||||||
"Privileged": false,
|
|
||||||
"PortBindings": {
|
|
||||||
"80/tcp": [
|
|
||||||
{
|
|
||||||
"HostIp": "0.0.0.0",
|
|
||||||
"HostPort": "80"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"Links": null,
|
|
||||||
"PublishAllPorts": false,
|
|
||||||
"DriverOptions": {
|
|
||||||
"lxc": null
|
|
||||||
},
|
|
||||||
"CliAddress": ""
|
|
||||||
}
|
|
||||||
|
|
||||||
## Getting the IP address of a container instance
|
## Getting the IP address of a container instance
|
||||||
|
|
||||||
To get the IP address of a container use:
|
To get the IP address of a container use:
|
||||||
|
|
||||||
# docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
|
$ docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
|
||||||
172.17.0.2
|
172.17.0.2
|
||||||
|
|
||||||
## Listing all port bindings
|
## Listing all port bindings
|
||||||
|
@ -145,95 +175,96 @@ To get the IP address of a container use:
|
||||||
One can loop over arrays and maps in the results to produce simple text
|
One can loop over arrays and maps in the results to produce simple text
|
||||||
output:
|
output:
|
||||||
|
|
||||||
# docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
|
$ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
|
||||||
{{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
|
{{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
|
||||||
|
80/tcp -> 80
|
||||||
|
|
||||||
80/tcp -> 80
|
You can get more information about how to write a go template from:
|
||||||
|
http://golang.org/pkg/text/template/.
|
||||||
|
|
||||||
## Getting information on an image
|
## Getting information on an image
|
||||||
|
|
||||||
Use an image's ID or name (e.g., repository/name[:tag]) to get information
|
Use an image's ID or name (e.g., repository/name[:tag]) to get information
|
||||||
on it.
|
on it.
|
||||||
|
|
||||||
# docker inspect 58394af37342
|
$ docker inspect fc1203419df2
|
||||||
[{
|
[{
|
||||||
"id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9",
|
"Architecture": "amd64",
|
||||||
"parent": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
"Author": "",
|
||||||
"created": "2014-02-03T16:10:40.500814677Z",
|
"Comment": "",
|
||||||
"container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5",
|
"Config": {
|
||||||
"container_config": {
|
"AttachStderr": false,
|
||||||
"Hostname": "88807319f25e",
|
|
||||||
"Domainname": "",
|
|
||||||
"User": "",
|
|
||||||
"Memory": 0,
|
|
||||||
"MemorySwap": 0,
|
|
||||||
"CpuShares": 0,
|
|
||||||
"AttachStdin": false,
|
"AttachStdin": false,
|
||||||
"AttachStdout": false,
|
"AttachStdout": false,
|
||||||
"AttachStderr": false,
|
"Cmd": [
|
||||||
"PortSpecs": null,
|
"make",
|
||||||
"ExposedPorts": null,
|
"direct-test"
|
||||||
"Tty": false,
|
|
||||||
"OpenStdin": false,
|
|
||||||
"StdinOnce": false,
|
|
||||||
"Env": [
|
|
||||||
"HOME=/",
|
|
||||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
],
|
],
|
||||||
|
"Domainname": "",
|
||||||
|
"Entrypoint": [
|
||||||
|
"/dind"
|
||||||
|
],
|
||||||
|
"Env": [
|
||||||
|
"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||||
|
],
|
||||||
|
"ExposedPorts": null,
|
||||||
|
"Hostname": "242978536a06",
|
||||||
|
"Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
||||||
|
"Labels": {},
|
||||||
|
"MacAddress": "",
|
||||||
|
"NetworkDisabled": false,
|
||||||
|
"OnBuild": [],
|
||||||
|
"OpenStdin": false,
|
||||||
|
"PortSpecs": null,
|
||||||
|
"StdinOnce": false,
|
||||||
|
"Tty": false,
|
||||||
|
"User": "",
|
||||||
|
"Volumes": null,
|
||||||
|
"WorkingDir": "/go/src/github.com/docker/libcontainer"
|
||||||
|
},
|
||||||
|
"Container": "1c00417f3812a96d3ebc29e7fdee69f3d586d703ab89c8233fd4678d50707b39",
|
||||||
|
"ContainerConfig": {
|
||||||
|
"AttachStderr": false,
|
||||||
|
"AttachStdin": false,
|
||||||
|
"AttachStdout": false,
|
||||||
"Cmd": [
|
"Cmd": [
|
||||||
"/bin/sh",
|
"/bin/sh",
|
||||||
"-c",
|
"-c",
|
||||||
"#(nop) ADD fedora-20-dummy.tar.xz in /"
|
"#(nop) CMD [\"make\" \"direct-test\"]"
|
||||||
],
|
],
|
||||||
"Dns": null,
|
|
||||||
"DnsSearch": null,
|
|
||||||
"Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
|
||||||
"Volumes": null,
|
|
||||||
"VolumesFrom": "",
|
|
||||||
"WorkingDir": "",
|
|
||||||
"Entrypoint": null,
|
|
||||||
"NetworkDisabled": false,
|
|
||||||
"OnBuild": null,
|
|
||||||
"Context": null
|
|
||||||
},
|
|
||||||
"docker_version": "0.6.3",
|
|
||||||
"author": "I P Babble \u003clsm5@ipbabble.com\u003e - ./buildcontainers.sh",
|
|
||||||
"config": {
|
|
||||||
"Hostname": "88807319f25e",
|
|
||||||
"Domainname": "",
|
"Domainname": "",
|
||||||
"User": "",
|
"Entrypoint": [
|
||||||
"Memory": 0,
|
"/dind"
|
||||||
"MemorySwap": 0,
|
|
||||||
"CpuShares": 0,
|
|
||||||
"AttachStdin": false,
|
|
||||||
"AttachStdout": false,
|
|
||||||
"AttachStderr": false,
|
|
||||||
"PortSpecs": null,
|
|
||||||
"ExposedPorts": null,
|
|
||||||
"Tty": false,
|
|
||||||
"OpenStdin": false,
|
|
||||||
"StdinOnce": false,
|
|
||||||
"Env": [
|
|
||||||
"HOME=/",
|
|
||||||
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
|
||||||
],
|
],
|
||||||
"Cmd": null,
|
"Env": [
|
||||||
"Dns": null,
|
"PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
|
||||||
"DnsSearch": null,
|
],
|
||||||
"Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
|
"ExposedPorts": null,
|
||||||
"Volumes": null,
|
"Hostname": "242978536a06",
|
||||||
"VolumesFrom": "",
|
"Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
||||||
"WorkingDir": "",
|
"Labels": {},
|
||||||
"Entrypoint": null,
|
"MacAddress": "",
|
||||||
"NetworkDisabled": false,
|
"NetworkDisabled": false,
|
||||||
"OnBuild": null,
|
"OnBuild": [],
|
||||||
"Context": null
|
"OpenStdin": false,
|
||||||
|
"PortSpecs": null,
|
||||||
|
"StdinOnce": false,
|
||||||
|
"Tty": false,
|
||||||
|
"User": "",
|
||||||
|
"Volumes": null,
|
||||||
|
"WorkingDir": "/go/src/github.com/docker/libcontainer"
|
||||||
},
|
},
|
||||||
"architecture": "x86_64",
|
"Created": "2015-04-07T05:34:39.079489206Z",
|
||||||
"Size": 385520098
|
"DockerVersion": "1.5.0-dev",
|
||||||
|
"Id": "fc1203419df26ca82cad1dd04c709cb1b8a8a947bd5bcbdfbef8241a76f031db",
|
||||||
|
"Os": "linux",
|
||||||
|
"Parent": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a",
|
||||||
|
"Size": 0,
|
||||||
|
"VirtualSize": 613136466
|
||||||
}]
|
}]
|
||||||
|
|
||||||
# HISTORY
|
# HISTORY
|
||||||
April 2014, Originally compiled by William Henry (whenry at redhat dot com)
|
April 2014, originally compiled by William Henry (whenry at redhat dot com)
|
||||||
based on docker.com source material and internal work.
|
based on docker.com source material and internal work.
|
||||||
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
|
||||||
|
April 2015, updated by Qiang Huang <h.huangqiang@huawei.com>
|
||||||
|
|
Loading…
Reference in New Issue