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