github.com/chenchun/docker@v1.3.2-0.20150629222414-20467faf132b/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 d2cc496561d6
    34  [{
    35      "Id": "d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
    36      "Created": "2015-06-08T16:18:02.505155285Z",
    37      "Path": "bash",
    38      "Args": [],
    39      "State": {
    40          "Running": false,
    41          "Paused": false,
    42          "Restarting": false,
    43          "OOMKilled": false,
    44          "Dead": false,
    45          "Pid": 0,
    46          "ExitCode": 0,
    47          "Error": "",
    48          "StartedAt": "2015-06-08T16:18:03.643865954Z",
    49          "FinishedAt": "2015-06-08T16:57:06.448552862Z"
    50      },
    51      "Image": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
    52      "NetworkSettings": {
    53          "Bridge": "",
    54          "EndpointID": "",
    55          "Gateway": "",
    56          "GlobalIPv6Address": "",
    57          "GlobalIPv6PrefixLen": 0,
    58          "HairpinMode": false,
    59          "IPAddress": "",
    60          "IPPrefixLen": 0,
    61          "IPv6Gateway": "",
    62          "LinkLocalIPv6Address": "",
    63          "LinkLocalIPv6PrefixLen": 0,
    64          "MacAddress": "",
    65          "NetworkID": "",
    66          "PortMapping": null,
    67          "Ports": null,
    68          "SandboxKey": "",
    69          "SecondaryIPAddresses": null,
    70          "SecondaryIPv6Addresses": null
    71      },
    72      "ResolvConfPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/resolv.conf",
    73      "HostnamePath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hostname",
    74      "HostsPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/hosts",
    75      "LogPath": "/var/lib/docker/containers/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47/d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47-json.log",
    76      "Name": "/adoring_wozniak",
    77      "RestartCount": 0,
    78      "Driver": "devicemapper",
    79      "ExecDriver": "native-0.2",
    80      "MountLabel": "",
    81      "ProcessLabel": "",
    82      "Volumes": {},
    83      "VolumesRW": {},
    84      "AppArmorProfile": "",
    85      "ExecIDs": null,
    86      "HostConfig": {
    87          "Binds": null,
    88          "ContainerIDFile": "",
    89          "LxcConf": [],
    90          "Memory": 0,
    91          "MemorySwap": 0,
    92          "CpuShares": 0,
    93          "CpuPeriod": 0,
    94          "CpusetCpus": "",
    95          "CpusetMems": "",
    96          "CpuQuota": 0,
    97          "BlkioWeight": 0,
    98          "OomKillDisable": false,
    99          "Privileged": false,
   100          "PortBindings": {},
   101          "Links": null,
   102          "PublishAllPorts": false,
   103          "Dns": null,
   104          "DnsSearch": null,
   105          "ExtraHosts": null,
   106          "VolumesFrom": null,
   107          "Devices": [],
   108          "NetworkMode": "bridge",
   109          "IpcMode": "",
   110          "PidMode": "",
   111          "UTSMode": "",
   112          "CapAdd": null,
   113          "CapDrop": null,
   114          "RestartPolicy": {
   115              "Name": "no",
   116              "MaximumRetryCount": 0
   117          },
   118          "SecurityOpt": null,
   119          "ReadonlyRootfs": false,
   120          "Ulimits": null,
   121          "LogConfig": {
   122              "Type": "json-file",
   123              "Config": {}
   124          },
   125          "CgroupParent": ""
   126      },
   127      "GraphDriver": {
   128          "Name": "devicemapper",
   129          "Data": {
   130              "DeviceId": "5",
   131              "DeviceName": "docker-253:1-2763198-d2cc496561d6d520cbc0236b4ba88c362c446a7619992123f11c809cded25b47",
   132              "DeviceSize": "171798691840"
   133          }
   134      },
   135      "Config": {
   136          "Hostname": "d2cc496561d6",
   137          "Domainname": "",
   138          "User": "",
   139          "AttachStdin": true,
   140          "AttachStdout": true,
   141          "AttachStderr": true,
   142          "ExposedPorts": null,
   143          "Tty": true,
   144          "OpenStdin": true,
   145          "StdinOnce": true,
   146          "Env": null,
   147          "Cmd": [
   148              "bash"
   149          ],
   150          "Image": "fedora",
   151          "Volumes": null,
   152          "VolumeDriver": "",
   153          "WorkingDir": "",
   154          "Entrypoint": null,
   155          "NetworkDisabled": false,
   156          "MacAddress": "",
   157          "OnBuild": null,
   158          "Labels": {},
   159          "Memory": 0,
   160          "MemorySwap": 0,
   161          "CpuShares": 0,
   162          "Cpuset": ""
   163      }
   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}}' d2cc496561d6
   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}}' d2cc496561d6
   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 ded7cd95e059
   191  [{
   192      "Id": "ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
   193      "Parent": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
   194      "Comment": "",
   195      "Created": "2015-05-27T16:58:22.937503085Z",
   196      "Container": "76cf7f67d83a7a047454b33007d03e32a8f474ad332c3a03c94537edd22b312b",
   197      "ContainerConfig": {
   198          "Hostname": "76cf7f67d83a",
   199          "Domainname": "",
   200          "User": "",
   201          "AttachStdin": false,
   202          "AttachStdout": false,
   203          "AttachStderr": false,
   204          "ExposedPorts": null,
   205          "Tty": false,
   206          "OpenStdin": false,
   207          "StdinOnce": false,
   208          "Env": null,
   209          "Cmd": [
   210              "/bin/sh",
   211              "-c",
   212              "#(nop) ADD file:4be46382bcf2b095fcb9fe8334206b584eff60bb3fad8178cbd97697fcb2ea83 in /"
   213          ],
   214          "Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
   215          "Volumes": null,
   216          "VolumeDriver": "",
   217          "WorkingDir": "",
   218          "Entrypoint": null,
   219          "NetworkDisabled": false,
   220          "MacAddress": "",
   221          "OnBuild": null,
   222          "Labels": {}
   223      },
   224      "DockerVersion": "1.6.0",
   225      "Author": "Lokesh Mandvekar \u003clsm5@fedoraproject.org\u003e",
   226      "Config": {
   227          "Hostname": "76cf7f67d83a",
   228          "Domainname": "",
   229          "User": "",
   230          "AttachStdin": false,
   231          "AttachStdout": false,
   232          "AttachStderr": false,
   233          "ExposedPorts": null,
   234          "Tty": false,
   235          "OpenStdin": false,
   236          "StdinOnce": false,
   237          "Env": null,
   238          "Cmd": null,
   239          "Image": "48ecf305d2cf7046c1f5f8fcbcd4994403173441d4a7f125b1bb0ceead9de731",
   240          "Volumes": null,
   241          "VolumeDriver": "",
   242          "WorkingDir": "",
   243          "Entrypoint": null,
   244          "NetworkDisabled": false,
   245          "MacAddress": "",
   246          "OnBuild": null,
   247          "Labels": {}
   248      },
   249      "Architecture": "amd64",
   250      "Os": "linux",
   251      "Size": 186507296,
   252      "VirtualSize": 186507296,
   253      "GraphDriver": {
   254          "Name": "devicemapper",
   255          "Data": {
   256              "DeviceId": "3",
   257              "DeviceName": "docker-253:1-2763198-ded7cd95e059788f2586a51c275a4f151653779d6a7f4dad77c2bd34601d94e4",
   258              "DeviceSize": "171798691840"
   259          }
   260      }
   261  }
   262  ]
   263  
   264  # HISTORY
   265  April 2014, originally compiled by William Henry (whenry at redhat dot com)
   266  based on docker.com source material and internal work.
   267  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
   268  April 2015, updated by Qiang Huang <h.huangqiang@huawei.com>