1DOCKER(1) JUNE 2014 DOCKER(1)
2
3
4
6 docker-inspect - Return low-level information on docker objects
7
8
9
11 docker inspect [--help] [-f|--format[=FORMAT]] [-s|--size]
12 [--type=container|image|network|node|service|task|volume] NAME|ID
13 [NAME|ID...]
14
15
16
18 This displays the low-level information on Docker object(s) (e.g.
19 container, image, volume,network, node, service, or task) identified by
20 name or ID. By default, this will render all results in a JSON array.
21 If the container and image have the same name, this will return
22 container JSON for unspecified type. If a format is specified, the
23 given template will be executed for each result.
24
25
26
28 --help
29 Print usage statement
30
31
32 -f, --format=""
33 Format the output using the given Go template
34
35
36 -s, --size
37 Display total file sizes if the type is container
38
39
40 --type=container|image|network|node|service|task|volume
41 Return JSON for specified type, permissible values are "image",
42 "container",
43 "network", "node", "service", "task", and "volume"
44
45
46
48 Get information about an image when image name conflicts with the
49 container name, e.g. both image and container are named rhel7:
50
51
52 $ docker inspect --type=image rhel7
53 [
54 {
55 "Id": "fe01a428b9d9de35d29531e9994157978e8c48fa693e1bf1d221dffbbb67b170",
56 "Parent": "10acc31def5d6f249b548e01e8ffbaccfd61af0240c17315a7ad393d022c5ca2",
57 ....
58 }
59 ]
60
61
62
64 To get information on a container use its ID or instance name:
65
66
67 $ docker inspect d2cc496561d6
68 [{
69 "Id": "d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
70 "Created": "2015-06-08T16:18:02.505155285Z",
71 "Path": "bash",
72 "Args": [],
73 "State": {
74 "Running": false,
75 "Paused": false,
76 "Restarting": false,
77 "OOMKilled": false,
78 "Dead": false,
79 "Pid": 0,
80 "ExitCode": 0,
81 "Error": "",
82 "StartedAt": "2015-06-08T16:18:03.643865954Z",
83 "FinishedAt": "2015-06-08T16:57:06.448552862Z"
84 },
85 "Image": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
86 "NetworkSettings": {
87 "Bridge": "",
88 "SandboxID": "6b4851d1903e16dd6a567bd526553a86664361f31036eaaa2f8454d6f4611f6f",
89 "HairpinMode": false,
90 "LinkLocalIPv6Address": "",
91 "LinkLocalIPv6PrefixLen": 0,
92 "Ports": {},
93 "SandboxKey": "/var/run/docker/netns/6b4851d1903e",
94 "SecondaryIPAddresses": null,
95 "SecondaryIPv6Addresses": null,
96 "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
97 "Gateway": "172.17.0.1",
98 "GlobalIPv6Address": "",
99 "GlobalIPv6PrefixLen": 0,
100 "IPAddress": "172.17.0.2",
101 "IPPrefixLen": 16,
102 "IPv6Gateway": "",
103 "MacAddress": "02:42:ac:12:00:02",
104 "Networks": {
105 "bridge": {
106 "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
107 "EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
108 "Gateway": "172.17.0.1",
109 "IPAddress": "172.17.0.2",
110 "IPPrefixLen": 16,
111 "IPv6Gateway": "",
112 "GlobalIPv6Address": "",
113 "GlobalIPv6PrefixLen": 0,
114 "MacAddress": "02:42:ac:12:00:02"
115 }
116 }
117
118 },
119 "ResolvConfPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/resolv.conf",
120 "HostnamePath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hostname",
121 "HostsPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hosts",
122 "LogPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47-json.log",
123 "Name": "/adoring_wozniak",
124 "RestartCount": 0,
125 "Driver": "devicemapper",
126 "MountLabel": "",
127 "ProcessLabel": "",
128 "Mounts": [
129 {
130 "Source": "/data",
131 "Destination": "/data",
132 "Mode": "ro,Z",
133 "RW": false
134 "Propagation": ""
135 }
136 ],
137 "AppArmorProfile": "",
138 "ExecIDs": null,
139 "HostConfig": {
140 "Binds": null,
141 "ContainerIDFile": "",
142 "Memory": 0,
143 "MemorySwap": 0,
144 "CpuShares": 0,
145 "CpuPeriod": 0,
146 "CpusetCpus": "",
147 "CpusetMems": "",
148 "CpuQuota": 0,
149 "BlkioWeight": 0,
150 "OomKillDisable": false,
151 "Privileged": false,
152 "PortBindings": {},
153 "Links": null,
154 "PublishAllPorts": false,
155 "Dns": null,
156 "DnsSearch": null,
157 "DnsOptions": null,
158 "ExtraHosts": null,
159 "VolumesFrom": null,
160 "Devices": [],
161 "NetworkMode": "bridge",
162 "IpcMode": "",
163 "PidMode": "",
164 "UTSMode": "",
165 "CapAdd": null,
166 "CapDrop": null,
167 "RestartPolicy": {
168 "Name": "no",
169 "MaximumRetryCount": 0
170 },
171 "SecurityOpt": null,
172 "ReadonlyRootfs": false,
173 "Ulimits": null,
174 "LogConfig": {
175 "Type": "json-file",
176 "Config": {}
177 },
178 "CgroupParent": ""
179 },
180 "GraphDriver": {
181 "Name": "devicemapper",
182 "Data": {
183 "DeviceId": "5",
184 "DeviceName": "docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
185 "DeviceSize": "171798691840"
186 }
187 },
188 "Config": {
189 "Hostname": "d2cc496561d6",
190 "Domainname": "",
191 "User": "",
192 "AttachStdin": true,
193 "AttachStdout": true,
194 "AttachStderr": true,
195 "ExposedPorts": null,
196 "Tty": true,
197 "OpenStdin": true,
198 "StdinOnce": true,
199 "Env": null,
200 "Cmd": [
201 "bash"
202 ],
203 "Image": "fedora",
204 "Volumes": null,
205 "VolumeDriver": "",
206 "WorkingDir": "",
207 "Entrypoint": null,
208 "NetworkDisabled": false,
209 "MacAddress": "",
210 "OnBuild": null,
211 "Labels": {},
212 "Memory": 0,
213 "MemorySwap": 0,
214 "CpuShares": 0,
215 "Cpuset": "",
216 "StopSignal": "SIGTERM"
217 }
218 }
219 ]
220
221
222
224 To get the IP address of a container use:
225
226
227 $ docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' d2cc496561d6
228 172.17.0.2
229
230
231
233 One can loop over arrays and maps in the results to produce simple text
234 output:
235
236
237 $ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
238 {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' d2cc496561d6
239 80/tcp -> 80
240
241
242
243 You can get more information about how to write a Go template from:
244
245 ⟨https://golang.org/pkg/text/template/⟩.
246
247
249 $ docker inspect -s d2cc496561d6
250 [
251 {
252 "SizeRw": 0,
253 "SizeRootFs": 972,
254 }
255 ]
256
257
258
260 Use an image's ID or name (e.g., repository/name[:tag]) to get
261 information about the image:
262
263
264 $ docker inspect ded7cd95e059
265 [{
266 "Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
267 "Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
268 "Comment": "",
269 "Created": "2015-05-27T16:58:22.937503085Z",
270 "Container": "76cf7f67d83a7a047454b33007d03e32a8f474ad332c3a03c94537edd22b312b",
271 "ContainerConfig": {
272 "Hostname": "76cf7f67d83a",
273 "Domainname": "",
274 "User": "",
275 "AttachStdin": false,
276 "AttachStdout": false,
277 "AttachStderr": false,
278 "ExposedPorts": null,
279 "Tty": false,
280 "OpenStdin": false,
281 "StdinOnce": false,
282 "Env": null,
283 "Cmd": [
284 "/bin/sh",
285 "-c",
286 "#(nop) ADD file:4be46382bcf2b095fcb9fe8334206b584eff60bb3fad8178cbd97697fcb2ea83 in /"
287 ],
288 "Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
289 "Volumes": null,
290 "VolumeDriver": "",
291 "WorkingDir": "",
292 "Entrypoint": null,
293 "NetworkDisabled": false,
294 "MacAddress": "",
295 "OnBuild": null,
296 "Labels": {}
297 },
298 "DockerVersion": "1.6.0",
299 "Author": "Lokesh Mandvekar \u003clsm5@fedoraproject.org\u003e",
300 "Config": {
301 "Hostname": "76cf7f67d83a",
302 "Domainname": "",
303 "User": "",
304 "AttachStdin": false,
305 "AttachStdout": false,
306 "AttachStderr": false,
307 "ExposedPorts": null,
308 "Tty": false,
309 "OpenStdin": false,
310 "StdinOnce": false,
311 "Env": null,
312 "Cmd": null,
313 "Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
314 "Volumes": null,
315 "VolumeDriver": "",
316 "WorkingDir": "",
317 "Entrypoint": null,
318 "NetworkDisabled": false,
319 "MacAddress": "",
320 "OnBuild": null,
321 "Labels": {}
322 },
323 "Architecture": "amd64",
324 "Os": "linux",
325 "Size": 186507296,
326 "VirtualSize": 186507296,
327 "GraphDriver": {
328 "Name": "devicemapper",
329 "Data": {
330 "DeviceId": "3",
331 "DeviceName": "docker-253:1-2763198-ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
332 "DeviceSize": "171798691840"
333 }
334 }
335 }
336 ]
337
338
339
340
342 April 2014, originally compiled by William Henry (whenry at redhat dot
343 com) based on docker.com source material and internal work. June 2014,
344 updated by Sven Dowideit ⟨SvenDowideit@home.org.au⟩ April 2015, updated
345 by Qiang Huang ⟨h.huangqiang@huawei.com⟩ October 2015, updated by Sally
346 O'Malley ⟨somalley@redhat.com⟩
347
348
349
350Docker Community Docker User Manuals DOCKER(1)