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