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