github.com/lmars/docker@v1.6.0-rc2/docs/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 it's ID or instance name: 32 33 #docker inspect 1eb5fabf5a03 34 [{ 35 "ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b", 36 "Created": "2014-04-04T21:33:52.02361335Z", 37 "Path": "/usr/sbin/nginx", 38 "Args": [], 39 "Config": { 40 "Hostname": "1eb5fabf5a03", 41 "Domainname": "", 42 "User": "", 43 "Memory": 0, 44 "MemorySwap": 0, 45 "CpuShares": 0, 46 "AttachStdin": false, 47 "AttachStdout": false, 48 "AttachStderr": false, 49 "PortSpecs": null, 50 "ExposedPorts": { 51 "80/tcp": {} 52 }, 53 "Tty": true, 54 "OpenStdin": false, 55 "StdinOnce": false, 56 "Env": [ 57 "HOME=/", 58 "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 59 ], 60 "Cmd": [ 61 "/usr/sbin/nginx" 62 ], 63 "Dns": null, 64 "DnsSearch": null, 65 "Image": "summit/nginx", 66 "Volumes": null, 67 "VolumesFrom": "", 68 "WorkingDir": "", 69 "Entrypoint": null, 70 "NetworkDisabled": false, 71 "OnBuild": null, 72 "Context": { 73 "mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650", 74 "process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650" 75 } 76 }, 77 "State": { 78 "Running": true, 79 "Pid": 858, 80 "ExitCode": 0, 81 "StartedAt": "2014-04-04T21:33:54.16259207Z", 82 "FinishedAt": "0001-01-01T00:00:00Z", 83 "Ghost": false 84 }, 85 "Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6", 86 "Labels": { 87 "com.example.vendor": "Acme", 88 "com.example.license": "GPL", 89 "com.example.version": "1.0" 90 }, 91 "NetworkSettings": { 92 "IPAddress": "172.17.0.2", 93 "IPPrefixLen": 16, 94 "Gateway": "172.17.42.1", 95 "Bridge": "docker0", 96 "PortMapping": null, 97 "Ports": { 98 "80/tcp": [ 99 { 100 "HostIp": "0.0.0.0", 101 "HostPort": "80" 102 } 103 ] 104 } 105 }, 106 "ResolvConfPath": "/etc/resolv.conf", 107 "HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname", 108 "HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts", 109 "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log", 110 "Name": "/ecstatic_ptolemy", 111 "Driver": "devicemapper", 112 "ExecDriver": "native-0.1", 113 "Volumes": {}, 114 "VolumesRW": {}, 115 "HostConfig": { 116 "Binds": null, 117 "ContainerIDFile": "", 118 "LxcConf": [], 119 "Privileged": false, 120 "PortBindings": { 121 "80/tcp": [ 122 { 123 "HostIp": "0.0.0.0", 124 "HostPort": "80" 125 } 126 ] 127 }, 128 "Links": null, 129 "PublishAllPorts": false, 130 "DriverOptions": { 131 "lxc": null 132 }, 133 "CliAddress": "" 134 } 135 136 ## Getting the IP address of a container instance 137 138 To get the IP address of a container use: 139 140 # docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03 141 172.17.0.2 142 143 ## Listing all port bindings 144 145 One can loop over arrays and maps in the results to produce simple text 146 output: 147 148 # docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \ 149 {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03 150 151 80/tcp -> 80 152 153 ## Getting information on an image 154 155 Use an image's ID or name (e.g., repository/name[:tag]) to get information 156 on it. 157 158 # docker inspect 58394af37342 159 [{ 160 "id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9", 161 "parent": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", 162 "created": "2014-02-03T16:10:40.500814677Z", 163 "container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5", 164 "container_config": { 165 "Hostname": "88807319f25e", 166 "Domainname": "", 167 "User": "", 168 "Memory": 0, 169 "MemorySwap": 0, 170 "CpuShares": 0, 171 "AttachStdin": false, 172 "AttachStdout": false, 173 "AttachStderr": false, 174 "PortSpecs": null, 175 "ExposedPorts": null, 176 "Tty": false, 177 "OpenStdin": false, 178 "StdinOnce": false, 179 "Env": [ 180 "HOME=/", 181 "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 182 ], 183 "Cmd": [ 184 "/bin/sh", 185 "-c", 186 "#(nop) ADD fedora-20-dummy.tar.xz in /" 187 ], 188 "Dns": null, 189 "DnsSearch": null, 190 "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", 191 "Volumes": null, 192 "VolumesFrom": "", 193 "WorkingDir": "", 194 "Entrypoint": null, 195 "NetworkDisabled": false, 196 "OnBuild": null, 197 "Context": null 198 }, 199 "docker_version": "0.6.3", 200 "author": "I P Babble \u003clsm5@ipbabble.com\u003e - ./buildcontainers.sh", 201 "config": { 202 "Hostname": "88807319f25e", 203 "Domainname": "", 204 "User": "", 205 "Memory": 0, 206 "MemorySwap": 0, 207 "CpuShares": 0, 208 "AttachStdin": false, 209 "AttachStdout": false, 210 "AttachStderr": false, 211 "PortSpecs": null, 212 "ExposedPorts": null, 213 "Tty": false, 214 "OpenStdin": false, 215 "StdinOnce": false, 216 "Env": [ 217 "HOME=/", 218 "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 219 ], 220 "Cmd": null, 221 "Dns": null, 222 "DnsSearch": null, 223 "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db", 224 "Volumes": null, 225 "VolumesFrom": "", 226 "WorkingDir": "", 227 "Entrypoint": null, 228 "NetworkDisabled": false, 229 "OnBuild": null, 230 "Context": null 231 }, 232 "architecture": "x86_64", 233 "Size": 385520098 234 }] 235 236 # HISTORY 237 April 2014, Originally compiled by William Henry (whenry at redhat dot com) 238 based on docker.com source material and internal work. 239 June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>