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