docker-inspect.1 6.6 KB

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