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