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