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