github.com/tsuna/docker@v1.7.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 CONTAINER|IMAGE [CONTAINER|IMAGE...] 12 13 # DESCRIPTION 14 15 This displays all the information available in Docker for a given 16 container or image. By default, this will render all results in a JSON 17 array. If a format is specified, the given template will be executed for 18 each result. 19 20 # OPTIONS 21 **--help** 22 Print usage statement 23 24 **-f**, **--format**="" 25 Format the output using the given go template. 26 27 # EXAMPLES 28 29 ## Getting information on a container 30 31 To get information on a container use its ID or instance name: 32 33 $ docker inspect 1eb5fabf5a03 34 [{ 35 "AppArmorProfile": "", 36 "Args": [], 37 "Config": { 38 "AttachStderr": false, 39 "AttachStdin": false, 40 "AttachStdout": false, 41 "Cmd": [ 42 "/usr/sbin/nginx" 43 ], 44 "Domainname": "", 45 "Entrypoint": null, 46 "Env": [ 47 "HOME=/", 48 "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 49 ], 50 "ExposedPorts": { 51 "80/tcp": {} 52 }, 53 "Hostname": "1eb5fabf5a03", 54 "Image": "summit/nginx", 55 "Labels": { 56 "com.example.vendor": "Acme", 57 "com.example.license": "GPL", 58 "com.example.version": "1.0" 59 }, 60 "MacAddress": "", 61 "NetworkDisabled": false, 62 "OnBuild": null, 63 "OpenStdin": false, 64 "PortSpecs": null, 65 "StdinOnce": false, 66 "Tty": true, 67 "User": "", 68 "Volumes": null, 69 "WorkingDir": "", 70 }, 71 "Created": "2014-04-04T21:33:52.02361335Z", 72 "Driver": "devicemapper", 73 "ExecDriver": "native-0.1", 74 "ExecIDs": null, 75 "HostConfig": { 76 "Binds": null, 77 "CapAdd": null, 78 "CapDrop": null, 79 "CgroupParent": "", 80 "ContainerIDFile": "", 81 "CpuShares": 512, 82 "CpusetCpus": "0,1", 83 "CpusetMems": "", 84 "Devices": [], 85 "Dns": null, 86 "DnsSearch": null, 87 "ExtraHosts": null, 88 "IpcMode": "", 89 "Links": null, 90 "LogConfig": { 91 "Config": null, 92 "Type": "json-file" 93 }, 94 "LxcConf": null, 95 "Memory": 16777216, 96 "MemorySwap": -1, 97 "NetworkMode": "", 98 "PidMode": "", 99 "PortBindings": { 100 "80/tcp": [ 101 { 102 "HostIp": "0.0.0.0", 103 "HostPort": "80" 104 } 105 ] 106 }, 107 "Privileged": false, 108 "PublishAllPorts": false, 109 "ReadonlyRootfs": false, 110 "RestartPolicy": { 111 "MaximumRetryCount": 0, 112 "Name": "" 113 }, 114 "SecurityOpt": null, 115 "Ulimits": null, 116 "VolumesFrom": null 117 } 118 "HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname", 119 "HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts", 120 "ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b", 121 "Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6", 122 "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", 123 "MountLabel": "", 124 "Name": "/ecstatic_ptolemy", 125 "NetworkSettings": { 126 "Bridge": "docker0", 127 "Gateway": "172.17.42.1", 128 "GlobalIPv6Address": "", 129 "GlobalIPv6PrefixLen": 0, 130 "IPAddress": "172.17.0.2", 131 "IPPrefixLen": 16, 132 "IPv6Gateway": "", 133 "LinkLocalIPv6Address": "", 134 "LinkLocalIPv6PrefixLen": 0, 135 "MacAddress": "", 136 "PortMapping": null, 137 "Ports": { 138 "80/tcp": [ 139 { 140 "HostIp": "0.0.0.0", 141 "HostPort": "80" 142 } 143 ] 144 } 145 }, 146 "Path": "/usr/sbin/nginx", 147 "ProcessLabel": "", 148 "ResolvConfPath": "/etc/resolv.conf", 149 "RestartCount": 0, 150 "State": { 151 "Dead": false, 152 "Error": "", 153 "ExitCode": 0, 154 "FinishedAt": "0001-01-01T00:00:00Z", 155 "OOMKilled": false, 156 "Paused": false, 157 "Pid": 858, 158 "Restarting": false, 159 "Running": true, 160 "StartedAt": "2014-04-04T21:33:54.16259207Z", 161 }, 162 "Volumes": {}, 163 "VolumesRW": {}, 164 } 165 166 ## Getting the IP address of a container instance 167 168 To get the IP address of a container use: 169 170 $ docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03 171 172.17.0.2 172 173 ## Listing all port bindings 174 175 One can loop over arrays and maps in the results to produce simple text 176 output: 177 178 $ docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \ 179 {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03 180 80/tcp -> 80 181 182 You can get more information about how to write a go template from: 183 http://golang.org/pkg/text/template/. 184 185 ## Getting information on an image 186 187 Use an image's ID or name (e.g., repository/name[:tag]) to get information 188 on it. 189 190 $ docker inspect fc1203419df2 191 [{ 192 "Architecture": "amd64", 193 "Author": "", 194 "Comment": "", 195 "Config": { 196 "AttachStderr": false, 197 "AttachStdin": false, 198 "AttachStdout": false, 199 "Cmd": [ 200 "make", 201 "direct-test" 202 ], 203 "Domainname": "", 204 "Entrypoint": [ 205 "/dind" 206 ], 207 "Env": [ 208 "PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 209 ], 210 "ExposedPorts": null, 211 "Hostname": "242978536a06", 212 "Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a", 213 "Labels": {}, 214 "MacAddress": "", 215 "NetworkDisabled": false, 216 "OnBuild": [], 217 "OpenStdin": false, 218 "PortSpecs": null, 219 "StdinOnce": false, 220 "Tty": false, 221 "User": "", 222 "Volumes": null, 223 "WorkingDir": "/go/src/github.com/docker/libcontainer" 224 }, 225 "Container": "1c00417f3812a96d3ebc29e7fdee69f3d586d703ab89c8233fd4678d50707b39", 226 "ContainerConfig": { 227 "AttachStderr": false, 228 "AttachStdin": false, 229 "AttachStdout": false, 230 "Cmd": [ 231 "/bin/sh", 232 "-c", 233 "#(nop) CMD [\"make\" \"direct-test\"]" 234 ], 235 "Domainname": "", 236 "Entrypoint": [ 237 "/dind" 238 ], 239 "Env": [ 240 "PATH=/go/bin:/usr/src/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 241 ], 242 "ExposedPorts": null, 243 "Hostname": "242978536a06", 244 "Image": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a", 245 "Labels": {}, 246 "MacAddress": "", 247 "NetworkDisabled": false, 248 "OnBuild": [], 249 "OpenStdin": false, 250 "PortSpecs": null, 251 "StdinOnce": false, 252 "Tty": false, 253 "User": "", 254 "Volumes": null, 255 "WorkingDir": "/go/src/github.com/docker/libcontainer" 256 }, 257 "Created": "2015-04-07T05:34:39.079489206Z", 258 "DockerVersion": "1.5.0-dev", 259 "Id": "fc1203419df26ca82cad1dd04c709cb1b8a8a947bd5bcbdfbef8241a76f031db", 260 "Os": "linux", 261 "Parent": "c2b774c744afc5bea603b5e6c5218539e506649326de3ea0135182f299d0519a", 262 "Size": 0, 263 "VirtualSize": 613136466 264 }] 265 266 # HISTORY 267 April 2014, originally compiled by William Henry (whenry at redhat dot com) 268 based on docker.com source material and internal work. 269 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au> 270 April 2015, updated by Qiang Huang <h.huangqiang@huawei.com>