github.com/nguyentm83/docker@v1.5.0/docs/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 it's ID or instance name:
    32  
    33      #docker inspect 1eb5fabf5a03
    34      [{
    35         "ID": "1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b",
    36         "Created": "2014-04-04T21:33:52.02361335Z",
    37         "Path": "/usr/sbin/nginx",
    38         "Args": [],
    39         "Config": {
    40              "Hostname": "1eb5fabf5a03",
    41              "Domainname": "",
    42              "User": "",
    43              "Memory": 0,
    44              "MemorySwap": 0,
    45              "CpuShares": 0,
    46              "AttachStdin": false,
    47              "AttachStdout": false,
    48              "AttachStderr": false,
    49              "PortSpecs": null,
    50              "ExposedPorts": {
    51                  "80/tcp": {}
    52          },
    53  	    "Tty": true,
    54              "OpenStdin": false,
    55              "StdinOnce": false,
    56              "Env": [
    57                 "HOME=/",
    58  	       "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    59              ],
    60              "Cmd": [
    61                  "/usr/sbin/nginx"
    62              ],
    63              "Dns": null,
    64              "DnsSearch": null,
    65              "Image": "summit/nginx",
    66              "Volumes": null,
    67              "VolumesFrom": "",
    68              "WorkingDir": "",
    69              "Entrypoint": null,
    70              "NetworkDisabled": false,
    71              "OnBuild": null,
    72              "Context": {
    73                 "mount_label": "system_u:object_r:svirt_sandbox_file_t:s0:c0,c650",
    74  	       "process_label": "system_u:system_r:svirt_lxc_net_t:s0:c0,c650"
    75  	    }
    76          },
    77          "State": {
    78              "Running": true,
    79              "Pid": 858,
    80              "ExitCode": 0,
    81              "StartedAt": "2014-04-04T21:33:54.16259207Z",
    82              "FinishedAt": "0001-01-01T00:00:00Z",
    83              "Ghost": false
    84          },
    85          "Image": "df53773a4390e25936f9fd3739e0c0e60a62d024ea7b669282b27e65ae8458e6",
    86          "NetworkSettings": {
    87              "IPAddress": "172.17.0.2",
    88              "IPPrefixLen": 16,
    89              "Gateway": "172.17.42.1",
    90              "Bridge": "docker0",
    91              "PortMapping": null,
    92              "Ports": {
    93                  "80/tcp": [
    94                      {
    95                          "HostIp": "0.0.0.0",
    96                          "HostPort": "80"
    97                      }
    98                  ]
    99              }
   100          },
   101          "ResolvConfPath": "/etc/resolv.conf",
   102          "HostnamePath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hostname",
   103          "HostsPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/hosts",
   104          "Name": "/ecstatic_ptolemy",
   105          "Driver": "devicemapper",
   106          "ExecDriver": "native-0.1",
   107          "Volumes": {},
   108          "VolumesRW": {},
   109          "HostConfig": {
   110          "Binds": null,
   111              "ContainerIDFile": "",
   112              "LxcConf": [],
   113              "Privileged": false,
   114              "PortBindings": {
   115                  "80/tcp": [
   116                      {
   117                          "HostIp": "0.0.0.0",
   118                          "HostPort": "80"
   119                      }
   120                  ]
   121              },
   122              "Links": null,
   123              "PublishAllPorts": false,
   124              "DriverOptions": {
   125                  "lxc": null
   126              },
   127              "CliAddress": ""
   128          }
   129  
   130  ## Getting the IP address of a container instance
   131  
   132  To get the IP address of a container use:
   133  
   134      # docker inspect --format='{{.NetworkSettings.IPAddress}}' 1eb5fabf5a03
   135      172.17.0.2
   136  
   137  ## Listing all port bindings
   138  
   139  One can loop over arrays and maps in the results to produce simple text
   140  output:
   141  
   142      # docker inspect --format='{{range $p, $conf := .NetworkSettings.Ports}} \
   143       {{$p}} -> {{(index $conf 0).HostPort}} {{end}}' 1eb5fabf5a03
   144  
   145      80/tcp -> 80
   146  
   147  ## Getting information on an image
   148  
   149  Use an image's ID or name (e.g., repository/name[:tag]) to get information
   150   on it.
   151  
   152      # docker inspect 58394af37342
   153      [{
   154          "id": "58394af373423902a1b97f209a31e3777932d9321ef10e64feaaa7b4df609cf9",
   155          "parent": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
   156          "created": "2014-02-03T16:10:40.500814677Z",
   157          "container": "f718f19a28a5147da49313c54620306243734bafa63c76942ef6f8c4b4113bc5",
   158          "container_config": {
   159              "Hostname": "88807319f25e",
   160              "Domainname": "",
   161              "User": "",
   162              "Memory": 0,
   163              "MemorySwap": 0,
   164              "CpuShares": 0,
   165              "AttachStdin": false,
   166              "AttachStdout": false,
   167              "AttachStderr": false,
   168              "PortSpecs": null,
   169              "ExposedPorts": null,
   170              "Tty": false,
   171              "OpenStdin": false,
   172              "StdinOnce": false,
   173              "Env": [
   174                  "HOME=/",
   175                  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   176              ],
   177              "Cmd": [
   178                  "/bin/sh",
   179                  "-c",
   180  		 "#(nop) ADD fedora-20-dummy.tar.xz in /"
   181              ],
   182              "Dns": null,
   183              "DnsSearch": null,
   184              "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
   185              "Volumes": null,
   186              "VolumesFrom": "",
   187              "WorkingDir": "",
   188              "Entrypoint": null,
   189              "NetworkDisabled": false,
   190              "OnBuild": null,
   191              "Context": null
   192          },
   193          "docker_version": "0.6.3",
   194          "author": "I P Babble \u003clsm5@ipbabble.com\u003e - ./buildcontainers.sh",
   195          "config": {
   196              "Hostname": "88807319f25e",
   197              "Domainname": "",
   198              "User": "",
   199              "Memory": 0,
   200              "MemorySwap": 0,
   201              "CpuShares": 0,
   202              "AttachStdin": false,
   203              "AttachStdout": false,
   204              "AttachStderr": false,
   205              "PortSpecs": null,
   206              "ExposedPorts": null,
   207              "Tty": false,
   208              "OpenStdin": false,
   209              "StdinOnce": false,
   210              "Env": [
   211                  "HOME=/",
   212  		        "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   213              ],
   214              "Cmd": null,
   215              "Dns": null,
   216              "DnsSearch": null,
   217              "Image": "8abc22bad04266308ff408ca61cb8f6f4244a59308f7efc64e54b08b496c58db",
   218              "Volumes": null,
   219              "VolumesFrom": "",
   220              "WorkingDir": "",
   221              "Entrypoint": null,
   222              "NetworkDisabled": false,
   223              "OnBuild": null,
   224              "Context": null
   225          },
   226  	"architecture": "x86_64",
   227  	"Size": 385520098
   228      }]
   229  
   230  # HISTORY
   231  April 2014, Originally compiled by William Henry (whenry at redhat dot com)
   232  based on docker.com source material and internal work.
   233  June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>