github.com/nf/docker@v1.8.1/docs/reference/api/docker_remote_api_v1.20.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Remote API v1.20"
     4  description = "API Documentation for Docker"
     5  keywords = ["API, Docker, rcli, REST,  documentation"]
     6  [menu.main]
     7  parent="smn_remoteapi"
     8  weight = 1
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Docker Remote API v1.20
    13  
    14  ## 1. Brief introduction
    15  
    16   - The Remote API has replaced `rcli`.
    17   - The daemon listens on `unix:///var/run/docker.sock` but you can
    18     [Bind Docker to another host/port or a Unix socket](
    19     /articles/basics/#bind-docker-to-another-hostport-or-a-unix-socket).
    20   - The API tends to be REST. However, for some complex commands, like `attach`
    21     or `pull`, the HTTP connection is hijacked to transport `stdout`,
    22     `stdin` and `stderr`.
    23   - When the client API version is newer than the daemon's, these calls return an HTTP
    24     `400 Bad Request` error message.
    25  
    26  # 2. Endpoints
    27  
    28  ## 2.1 Containers
    29  
    30  ### List containers
    31  
    32  `GET /containers/json`
    33  
    34  List containers
    35  
    36  **Example request**:
    37  
    38      GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
    39  
    40  **Example response**:
    41  
    42      HTTP/1.1 200 OK
    43      Content-Type: application/json
    44  
    45      [
    46           {
    47                   "Id": "8dfafdbc3a40",
    48                   "Names":["/boring_feynman"],
    49                   "Image": "ubuntu:latest",
    50                   "Command": "echo 1",
    51                   "Created": 1367854155,
    52                   "Status": "Exit 0",
    53                   "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
    54                   "Labels": {
    55                           "com.example.vendor": "Acme",
    56                           "com.example.license": "GPL",
    57                           "com.example.version": "1.0"
    58                   },
    59                   "SizeRw": 12288,
    60                   "SizeRootFs": 0
    61           },
    62           {
    63                   "Id": "9cd87474be90",
    64                   "Names":["/coolName"]
    65                   "Image": "ubuntu:latest",
    66                   "Command": "echo 222222",
    67                   "Created": 1367854155,
    68                   "Status": "Exit 0",
    69                   "Ports": [],
    70                   "Labels": {},
    71                   "SizeRw": 12288,
    72                   "SizeRootFs": 0
    73           },
    74           {
    75                   "Id": "3176a2479c92",
    76                   "Names":["/sleepy_dog"]
    77                   "Image": "ubuntu:latest",
    78                   "Command": "echo 3333333333333333",
    79                   "Created": 1367854154,
    80                   "Status": "Exit 0",
    81                   "Ports":[],
    82                   "Labels": {},
    83                   "SizeRw":12288,
    84                   "SizeRootFs":0
    85           },
    86           {
    87                   "Id": "4cb07b47f9fb",
    88                   "Names":["/running_cat"]
    89                   "Image": "ubuntu:latest",
    90                   "Command": "echo 444444444444444444444444444444444",
    91                   "Created": 1367854152,
    92                   "Status": "Exit 0",
    93                   "Ports": [],
    94                   "Labels": {},
    95                   "SizeRw": 12288,
    96                   "SizeRootFs": 0
    97           }
    98      ]
    99  
   100  Query Parameters:
   101  
   102  -   **all** – 1/True/true or 0/False/false, Show all containers.
   103          Only running containers are shown by default (i.e., this defaults to false)
   104  -   **limit** – Show `limit` last created
   105          containers, include non-running ones.
   106  -   **since** – Show only containers created since Id, include
   107          non-running ones.
   108  -   **before** – Show only containers created before Id, include
   109          non-running ones.
   110  -   **size** – 1/True/true or 0/False/false, Show the containers
   111          sizes
   112  -   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
   113    -   `exited=<int>`; -- containers with exit code of  `<int>` ;
   114    -   `status=`(`created`|`restarting`|`running`|`paused`|`exited`)
   115    -   `label=key` or `label="key=value"` of a container label
   116  
   117  Status Codes:
   118  
   119  -   **200** – no error
   120  -   **400** – bad parameter
   121  -   **500** – server error
   122  
   123  ### Create a container
   124  
   125  `POST /containers/create`
   126  
   127  Create a container
   128  
   129  **Example request**:
   130  
   131      POST /containers/create HTTP/1.1
   132      Content-Type: application/json
   133  
   134      {
   135             "Hostname": "",
   136             "Domainname": "",
   137             "User": "",
   138             "AttachStdin": false,
   139             "AttachStdout": true,
   140             "AttachStderr": true,
   141             "Tty": false,
   142             "OpenStdin": false,
   143             "StdinOnce": false,
   144             "Env": null,
   145             "Cmd": [
   146                     "date"
   147             ],
   148             "Entrypoint": "",
   149             "Image": "ubuntu",
   150             "Labels": {
   151                     "com.example.vendor": "Acme",
   152                     "com.example.license": "GPL",
   153                     "com.example.version": "1.0"
   154             },
   155             "Mounts": [
   156               {
   157                 "Source": "/data",
   158                 "Destination": "/data",
   159                 "Mode": "ro,Z",
   160                 "RW": false
   161               }
   162             ],
   163             "WorkingDir": "",
   164             "NetworkDisabled": false,
   165             "MacAddress": "12:34:56:78:9a:bc",
   166             "ExposedPorts": {
   167                     "22/tcp": {}
   168             },
   169             "HostConfig": {
   170               "Binds": ["/tmp:/tmp"],
   171               "Links": ["redis3:redis"],
   172               "LxcConf": {"lxc.utsname":"docker"},
   173               "Memory": 0,
   174               "MemorySwap": 0,
   175               "CpuShares": 512,
   176               "CpuPeriod": 100000,
   177               "CpusetCpus": "0,1",
   178               "CpusetMems": "0,1",
   179               "BlkioWeight": 300,
   180               "MemorySwappiness": 60,
   181               "OomKillDisable": false,
   182               "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
   183               "PublishAllPorts": false,
   184               "Privileged": false,
   185               "ReadonlyRootfs": false,
   186               "Dns": ["8.8.8.8"],
   187               "DnsSearch": [""],
   188               "ExtraHosts": null,
   189               "VolumesFrom": ["parent", "other:ro"],
   190               "CapAdd": ["NET_ADMIN"],
   191               "CapDrop": ["MKNOD"],
   192               "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
   193               "NetworkMode": "bridge",
   194               "Devices": [],
   195               "Ulimits": [{}],
   196               "LogConfig": { "Type": "json-file", "Config": {} },
   197               "SecurityOpt": [""],
   198               "CgroupParent": ""
   199            }
   200        }
   201  
   202  **Example response**:
   203  
   204        HTTP/1.1 201 Created
   205        Content-Type: application/json
   206  
   207        {
   208             "Id":"e90e34656806"
   209             "Warnings":[]
   210        }
   211  
   212  Json Parameters:
   213  
   214  -   **Hostname** - A string value containing the hostname to use for the
   215        container.
   216  -   **Domainname** - A string value containing the domain name to use
   217        for the container.
   218  -   **User** - A string value specifying the user inside the container.
   219  -   **Memory** - Memory limit in bytes.
   220  -   **MemorySwap**- Total memory limit (memory + swap); set `-1` to disable swap
   221        You must use this with `memory` and make the swap value larger than `memory`.
   222  -   **CpuShares** - An integer value containing the container's CPU Shares
   223        (ie. the relative weight vs other containers).
   224  -   **CpuPeriod** - The length of a CPU period in microseconds.
   225  -   **Cpuset** - Deprecated please don't use. Use `CpusetCpus` instead. 
   226  -   **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
   227  -   **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
   228  -   **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
   229  -   **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
   230  -   **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
   231  -   **AttachStdin** - Boolean value, attaches to `stdin`.
   232  -   **AttachStdout** - Boolean value, attaches to `stdout`.
   233  -   **AttachStderr** - Boolean value, attaches to `stderr`.
   234  -   **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
   235  -   **OpenStdin** - Boolean value, opens stdin,
   236  -   **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
   237  -   **Env** - A list of environment variables in the form of `VAR=value`
   238  -   **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value"[,"key2":"value2"]}`
   239  -   **Cmd** - Command to run specified as a string or an array of strings.
   240  -   **Entrypoint** - Set the entry point for the container as a string or an array
   241        of strings.
   242  -   **Image** - A string specifying the image name to use for the container.
   243  -   **Mounts** - An array of mount points in the container.
   244  -   **WorkingDir** - A string specifying the working directory for commands to
   245        run in.
   246  -   **NetworkDisabled** - Boolean value, when true disables networking for the
   247        container
   248  -   **ExposedPorts** - An object mapping ports to an empty object in the form of:
   249        `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
   250  -   **HostConfig**
   251      -   **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
   252             + `container_path` to create a new volume for the container
   253             + `host_path:container_path` to bind-mount a host path into the container
   254             + `host_path:container_path:ro` to make the bind-mount read-only inside the container.
   255      -   **Links** - A list of links for the container. Each link entry should be
   256            in the form of `container_name:alias`.
   257      -   **LxcConf** - LXC specific configurations. These configurations only
   258            work when using the `lxc` execution driver.
   259      -   **PortBindings** - A map of exposed container ports and the host port they
   260            should map to. A JSON object in the form
   261            `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
   262            Take note that `port` is specified as a string and not an integer value.
   263      -   **PublishAllPorts** - Allocates a random host port for all of a container's
   264            exposed ports. Specified as a boolean value.
   265      -   **Privileged** - Gives the container full access to the host. Specified as
   266            a boolean value.
   267      -   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
   268            Specified as a boolean value.
   269      -   **Dns** - A list of DNS servers for the container to use.
   270      -   **DnsSearch** - A list of DNS search domains
   271      -   **ExtraHosts** - A list of hostnames/IP mappings to add to the
   272          container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
   273      -   **VolumesFrom** - A list of volumes to inherit from another container.
   274            Specified in the form `<container name>[:<ro|rw>]`
   275      -   **CapAdd** - A list of kernel capabilities to add to the container.
   276      -   **Capdrop** - A list of kernel capabilities to drop from the container.
   277      -   **RestartPolicy** – The behavior to apply when the container exits.  The
   278              value is an object with a `Name` property of either `"always"` to
   279              always restart or `"on-failure"` to restart only when the container
   280              exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
   281              controls the number of times to retry before giving up.
   282              The default is not to restart. (optional)
   283              An ever increasing delay (double the previous delay, starting at 100mS)
   284              is added before each restart to prevent flooding the server.
   285      -   **NetworkMode** - Sets the networking mode for the container. Supported
   286            values are: `bridge`, `host`, and `container:<name|id>`
   287      -   **Devices** - A list of devices to add to the container specified as a JSON object in the
   288        form
   289            `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
   290      -   **Ulimits** - A list of ulimits to set in the container, specified as
   291            `{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
   292            `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard", 2048 }}`
   293      -   **SecurityOpt**: A list of string values to customize labels for MLS
   294          systems, such as SELinux.
   295      -   **LogConfig** - Log configuration for the container, specified as a JSON object in the form
   296            `{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
   297            Available types: `json-file`, `syslog`, `journald`, `gelf`, `none`.
   298            `json-file` logging driver.
   299      -   **CgroupParent** - Path to `cgroups` under which the container's `cgroup` is created. If the path is not absolute, the path is considered to be relative to the `cgroups` path of the init process. Cgroups are created if they do not already exist.
   300  
   301  Query Parameters:
   302  
   303  -   **name** – Assign the specified name to the container. Must
   304      match `/?[a-zA-Z0-9_-]+`.
   305  
   306  Status Codes:
   307  
   308  -   **201** – no error
   309  -   **404** – no such container
   310  -   **406** – impossible to attach (container not running)
   311  -   **500** – server error
   312  
   313  ### Inspect a container
   314  
   315  `GET /containers/(id)/json`
   316  
   317  Return low-level information on the container `id`
   318  
   319  
   320  **Example request**:
   321  
   322        GET /containers/4fa6e0f0c678/json HTTP/1.1
   323  
   324  **Example response**:
   325  
   326      HTTP/1.1 200 OK
   327      Content-Type: application/json
   328  
   329      {
   330  		"AppArmorProfile": "",
   331  		"Args": [
   332  			"-c",
   333  			"exit 9"
   334  		],
   335  		"Config": {
   336  			"AttachStderr": true,
   337  			"AttachStdin": false,
   338  			"AttachStdout": true,
   339  			"Cmd": [
   340  				"/bin/sh",
   341  				"-c",
   342  				"exit 9"
   343  			],
   344  			"Domainname": "",
   345  			"Entrypoint": null,
   346  			"Env": [
   347  				"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   348  			],
   349  			"ExposedPorts": null,
   350  			"Hostname": "ba033ac44011",
   351  			"Image": "ubuntu",
   352  			"Labels": {
   353  				"com.example.vendor": "Acme",
   354  				"com.example.license": "GPL",
   355  				"com.example.version": "1.0"
   356  			},
   357  			"MacAddress": "",
   358  			"NetworkDisabled": false,
   359  			"OnBuild": null,
   360  			"OpenStdin": false,
   361  			"StdinOnce": false,
   362  			"Tty": false,
   363  			"User": "",
   364  			"Volumes": null,
   365  			"WorkingDir": ""
   366  		},
   367  		"Created": "2015-01-06T15:47:31.485331387Z",
   368  		"Driver": "devicemapper",
   369  		"ExecDriver": "native-0.2",
   370  		"ExecIDs": null,
   371  		"HostConfig": {
   372  			"Binds": null,
   373  			"BlkioWeight": 0,
   374  			"CapAdd": null,
   375  			"CapDrop": null,
   376  			"ContainerIDFile": "",
   377  			"CpusetCpus": "",
   378  			"CpusetMems": "",
   379  			"CpuShares": 0,
   380  			"CpuPeriod": 100000,
   381  			"Devices": [],
   382  			"Dns": null,
   383  			"DnsSearch": null,
   384  			"ExtraHosts": null,
   385  			"IpcMode": "",
   386  			"Links": null,
   387  			"LxcConf": [],
   388  			"Memory": 0,
   389  			"MemorySwap": 0,
   390  			"OomKillDisable": false,
   391  			"NetworkMode": "bridge",
   392  			"PortBindings": {},
   393  			"Privileged": false,
   394  			"ReadonlyRootfs": false,
   395  			"PublishAllPorts": false,
   396  			"RestartPolicy": {
   397  				"MaximumRetryCount": 2,
   398  				"Name": "on-failure"
   399  			},
   400  			"LogConfig": {
   401  				"Config": null,
   402  				"Type": "json-file"
   403  			},
   404  			"SecurityOpt": null,
   405  			"VolumesFrom": null,
   406  			"Ulimits": [{}]
   407  		},
   408  		"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
   409  		"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
   410  		"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
   411  		"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
   412  		"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
   413  		"MountLabel": "",
   414  		"Name": "/boring_euclid",
   415  		"NetworkSettings": {
   416  			"Bridge": "",
   417  			"Gateway": "",
   418  			"IPAddress": "",
   419  			"IPPrefixLen": 0,
   420  			"MacAddress": "",
   421  			"PortMapping": null,
   422  			"Ports": null
   423  		},
   424  		"Path": "/bin/sh",
   425  		"ProcessLabel": "",
   426  		"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
   427  		"RestartCount": 1,
   428  		"State": {
   429  			"Error": "",
   430  			"ExitCode": 9,
   431  			"FinishedAt": "2015-01-06T15:47:32.080254511Z",
   432  			"OOMKilled": false,
   433  			"Paused": false,
   434  			"Pid": 0,
   435  			"Restarting": false,
   436  			"Running": false,
   437  			"StartedAt": "2015-01-06T15:47:32.072697474Z"
   438  		},
   439  		"Mounts": [
   440  			{
   441  				"Source": "/data",
   442  				"Destination": "/data",
   443  				"Mode": "ro,Z",
   444  				"RW": false
   445  			}
   446  		]
   447  	}
   448  
   449  Status Codes:
   450  
   451  -   **200** – no error
   452  -   **404** – no such container
   453  -   **500** – server error
   454  
   455  ### List processes running inside a container
   456  
   457  `GET /containers/(id)/top`
   458  
   459  List processes running inside the container `id`
   460  
   461  **Example request**:
   462  
   463      GET /containers/4fa6e0f0c678/top HTTP/1.1
   464  
   465  **Example response**:
   466  
   467      HTTP/1.1 200 OK
   468      Content-Type: application/json
   469  
   470      {
   471           "Titles": [
   472                   "USER",
   473                   "PID",
   474                   "%CPU",
   475                   "%MEM",
   476                   "VSZ",
   477                   "RSS",
   478                   "TTY",
   479                   "STAT",
   480                   "START",
   481                   "TIME",
   482                   "COMMAND"
   483                   ],
   484           "Processes": [
   485                   ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"],
   486                   ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"]
   487           ]
   488      }
   489  
   490  Query Parameters:
   491  
   492  -   **ps_args** – ps arguments to use (e.g., aux)
   493  
   494  Status Codes:
   495  
   496  -   **200** – no error
   497  -   **404** – no such container
   498  -   **500** – server error
   499  
   500  ### Get container logs
   501  
   502  `GET /containers/(id)/logs`
   503  
   504  Get `stdout` and `stderr` logs from the container ``id``
   505  
   506  > **Note**:
   507  > This endpoint works only for containers with `json-file` logging driver.
   508  
   509  **Example request**:
   510  
   511       GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
   512  
   513  **Example response**:
   514  
   515       HTTP/1.1 101 UPGRADED
   516       Content-Type: application/vnd.docker.raw-stream
   517       Connection: Upgrade
   518       Upgrade: tcp
   519  
   520       {{ STREAM }}
   521  
   522  Query Parameters:
   523  
   524  -   **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
   525  -   **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
   526  -   **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
   527  -   **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
   528      will only output log-entries since that timestamp. Default: 0 (unfiltered)
   529  -   **timestamps** – 1/True/true or 0/False/false, print timestamps for
   530          every log line. Default `false`.
   531  -   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
   532  
   533  Status Codes:
   534  
   535  -   **101** – no error, hints proxy about hijacking
   536  -   **200** – no error, no upgrade header found
   537  -   **404** – no such container
   538  -   **500** – server error
   539  
   540  ### Inspect changes on a container's filesystem
   541  
   542  `GET /containers/(id)/changes`
   543  
   544  Inspect changes on container `id`'s filesystem
   545  
   546  **Example request**:
   547  
   548      GET /containers/4fa6e0f0c678/changes HTTP/1.1
   549  
   550  **Example response**:
   551  
   552      HTTP/1.1 200 OK
   553      Content-Type: application/json
   554  
   555      [
   556           {
   557                   "Path": "/dev",
   558                   "Kind": 0
   559           },
   560           {
   561                   "Path": "/dev/kmsg",
   562                   "Kind": 1
   563           },
   564           {
   565                   "Path": "/test",
   566                   "Kind": 1
   567           }
   568      ]
   569  
   570  Values for `Kind`:
   571  
   572  - `0`: Modify
   573  - `1`: Add
   574  - `2`: Delete
   575  
   576  Status Codes:
   577  
   578  -   **200** – no error
   579  -   **404** – no such container
   580  -   **500** – server error
   581  
   582  ### Export a container
   583  
   584  `GET /containers/(id)/export`
   585  
   586  Export the contents of container `id`
   587  
   588  **Example request**:
   589  
   590      GET /containers/4fa6e0f0c678/export HTTP/1.1
   591  
   592  **Example response**:
   593  
   594      HTTP/1.1 200 OK
   595      Content-Type: application/octet-stream
   596  
   597      {{ TAR STREAM }}
   598  
   599  Status Codes:
   600  
   601  -   **200** – no error
   602  -   **404** – no such container
   603  -   **500** – server error
   604  
   605  ### Get container stats based on resource usage
   606  
   607  `GET /containers/(id)/stats`
   608  
   609  This endpoint returns a live stream of a container's resource usage statistics.
   610  
   611  > **Note**: this functionality currently only works when using the *libcontainer* exec-driver.
   612  
   613  **Example request**:
   614  
   615      GET /containers/redis1/stats HTTP/1.1
   616  
   617  **Example response**:
   618  
   619        HTTP/1.1 200 OK
   620        Content-Type: application/json
   621  
   622        {
   623           "read" : "2015-01-08T22:57:31.547920715Z",
   624           "network" : {
   625              "rx_dropped" : 0,
   626              "rx_bytes" : 648,
   627              "rx_errors" : 0,
   628              "tx_packets" : 8,
   629              "tx_dropped" : 0,
   630              "rx_packets" : 8,
   631              "tx_errors" : 0,
   632              "tx_bytes" : 648
   633           },
   634           "memory_stats" : {
   635              "stats" : {
   636                 "total_pgmajfault" : 0,
   637                 "cache" : 0,
   638                 "mapped_file" : 0,
   639                 "total_inactive_file" : 0,
   640                 "pgpgout" : 414,
   641                 "rss" : 6537216,
   642                 "total_mapped_file" : 0,
   643                 "writeback" : 0,
   644                 "unevictable" : 0,
   645                 "pgpgin" : 477,
   646                 "total_unevictable" : 0,
   647                 "pgmajfault" : 0,
   648                 "total_rss" : 6537216,
   649                 "total_rss_huge" : 6291456,
   650                 "total_writeback" : 0,
   651                 "total_inactive_anon" : 0,
   652                 "rss_huge" : 6291456,
   653                 "hierarchical_memory_limit" : 67108864,
   654                 "total_pgfault" : 964,
   655                 "total_active_file" : 0,
   656                 "active_anon" : 6537216,
   657                 "total_active_anon" : 6537216,
   658                 "total_pgpgout" : 414,
   659                 "total_cache" : 0,
   660                 "inactive_anon" : 0,
   661                 "active_file" : 0,
   662                 "pgfault" : 964,
   663                 "inactive_file" : 0,
   664                 "total_pgpgin" : 477
   665              },
   666              "max_usage" : 6651904,
   667              "usage" : 6537216,
   668              "failcnt" : 0,
   669              "limit" : 67108864
   670           },
   671           "blkio_stats" : {},
   672           "cpu_stats" : {
   673              "cpu_usage" : {
   674                 "percpu_usage" : [
   675                    16970827,
   676                    1839451,
   677                    7107380,
   678                    10571290
   679                 ],
   680                 "usage_in_usermode" : 10000000,
   681                 "total_usage" : 36488948,
   682                 "usage_in_kernelmode" : 20000000
   683              },
   684              "system_cpu_usage" : 20091722000000000,
   685              "throttling_data" : {}
   686           }
   687        }
   688  
   689  Query Parameters:
   690  
   691  -   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
   692  
   693  Status Codes:
   694  
   695  -   **200** – no error
   696  -   **404** – no such container
   697  -   **500** – server error
   698  
   699  ### Resize a container TTY
   700  
   701  `POST /containers/(id)/resize?h=<height>&w=<width>`
   702  
   703  Resize the TTY for container with  `id`. You must restart the container for the resize to take effect.
   704  
   705  **Example request**:
   706  
   707        POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
   708  
   709  **Example response**:
   710  
   711        HTTP/1.1 200 OK
   712        Content-Length: 0
   713        Content-Type: text/plain; charset=utf-8
   714  
   715  Status Codes:
   716  
   717  -   **200** – no error
   718  -   **404** – No such container
   719  -   **500** – Cannot resize container
   720  
   721  ### Start a container
   722  
   723  `POST /containers/(id)/start`
   724  
   725  Start the container `id`
   726  
   727  > **Note**:
   728  > For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
   729  > See [create a container](#create-a-container) for details.
   730  
   731  **Example request**:
   732  
   733      POST /containers/(id)/start HTTP/1.1
   734  
   735  **Example response**:
   736  
   737      HTTP/1.1 204 No Content
   738  
   739  Status Codes:
   740  
   741  -   **204** – no error
   742  -   **304** – container already started
   743  -   **404** – no such container
   744  -   **500** – server error
   745  
   746  ### Stop a container
   747  
   748  `POST /containers/(id)/stop`
   749  
   750  Stop the container `id`
   751  
   752  **Example request**:
   753  
   754      POST /containers/e90e34656806/stop?t=5 HTTP/1.1
   755  
   756  **Example response**:
   757  
   758      HTTP/1.1 204 No Content
   759  
   760  Query Parameters:
   761  
   762  -   **t** – number of seconds to wait before killing the container
   763  
   764  Status Codes:
   765  
   766  -   **204** – no error
   767  -   **304** – container already stopped
   768  -   **404** – no such container
   769  -   **500** – server error
   770  
   771  ### Restart a container
   772  
   773  `POST /containers/(id)/restart`
   774  
   775  Restart the container `id`
   776  
   777  **Example request**:
   778  
   779      POST /containers/e90e34656806/restart?t=5 HTTP/1.1
   780  
   781  **Example response**:
   782  
   783      HTTP/1.1 204 No Content
   784  
   785  Query Parameters:
   786  
   787  -   **t** – number of seconds to wait before killing the container
   788  
   789  Status Codes:
   790  
   791  -   **204** – no error
   792  -   **404** – no such container
   793  -   **500** – server error
   794  
   795  ### Kill a container
   796  
   797  `POST /containers/(id)/kill`
   798  
   799  Kill the container `id`
   800  
   801  **Example request**:
   802  
   803      POST /containers/e90e34656806/kill HTTP/1.1
   804  
   805  **Example response**:
   806  
   807      HTTP/1.1 204 No Content
   808  
   809  Query Parameters
   810  
   811  -   **signal** - Signal to send to the container: integer or string like `SIGINT`.
   812          When not set, `SIGKILL` is assumed and the call waits for the container to exit.
   813  
   814  Status Codes:
   815  
   816  -   **204** – no error
   817  -   **404** – no such container
   818  -   **500** – server error
   819  
   820  ### Rename a container
   821  
   822  `POST /containers/(id)/rename`
   823  
   824  Rename the container `id` to a `new_name`
   825  
   826  **Example request**:
   827  
   828      POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
   829  
   830  **Example response**:
   831  
   832      HTTP/1.1 204 No Content
   833  
   834  Query Parameters:
   835  
   836  -   **name** – new name for the container
   837  
   838  Status Codes:
   839  
   840  -   **204** – no error
   841  -   **404** – no such container
   842  -   **409** - conflict name already assigned
   843  -   **500** – server error
   844  
   845  ### Pause a container
   846  
   847  `POST /containers/(id)/pause`
   848  
   849  Pause the container `id`
   850  
   851  **Example request**:
   852  
   853      POST /containers/e90e34656806/pause HTTP/1.1
   854  
   855  **Example response**:
   856  
   857      HTTP/1.1 204 No Content
   858  
   859  Status Codes:
   860  
   861  -   **204** – no error
   862  -   **404** – no such container
   863  -   **500** – server error
   864  
   865  ### Unpause a container
   866  
   867  `POST /containers/(id)/unpause`
   868  
   869  Unpause the container `id`
   870  
   871  **Example request**:
   872  
   873      POST /containers/e90e34656806/unpause HTTP/1.1
   874  
   875  **Example response**:
   876  
   877      HTTP/1.1 204 No Content
   878  
   879  Status Codes:
   880  
   881  -   **204** – no error
   882  -   **404** – no such container
   883  -   **500** – server error
   884  
   885  ### Attach to a container
   886  
   887  `POST /containers/(id)/attach`
   888  
   889  Attach to the container `id`
   890  
   891  **Example request**:
   892  
   893      POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
   894  
   895  **Example response**:
   896  
   897      HTTP/1.1 101 UPGRADED
   898      Content-Type: application/vnd.docker.raw-stream
   899      Connection: Upgrade
   900      Upgrade: tcp
   901  
   902      {{ STREAM }}
   903  
   904  Query Parameters:
   905  
   906  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   907  -   **stream** – 1/True/true or 0/False/false, return stream.
   908          Default `false`.
   909  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
   910          to `stdin`. Default `false`.
   911  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
   912          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
   913  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
   914          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
   915  
   916  Status Codes:
   917  
   918  -   **101** – no error, hints proxy about hijacking
   919  -   **200** – no error, no upgrade header found
   920  -   **400** – bad parameter
   921  -   **404** – no such container
   922  -   **500** – server error
   923  
   924      **Stream details**:
   925  
   926      When using the TTY setting is enabled in
   927      [`POST /containers/create`
   928      ](/reference/api/docker_remote_api_v1.9/#create-a-container "POST /containers/create"),
   929      the stream is the raw data from the process PTY and client's `stdin`.
   930      When the TTY is disabled, then the stream is multiplexed to separate
   931      `stdout` and `stderr`.
   932  
   933      The format is a **Header** and a **Payload** (frame).
   934  
   935      **HEADER**
   936  
   937      The header contains the information which the stream writes (`stdout` or
   938      `stderr`). It also contains the size of the associated frame encoded in the
   939      last four bytes (`uint32`).
   940  
   941      It is encoded on the first eight bytes like this:
   942  
   943          header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
   944  
   945      `STREAM_TYPE` can be:
   946  
   947  -   0: `stdin` (is written on `stdout`)
   948  -   1: `stdout`
   949  -   2: `stderr`
   950  
   951      `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
   952      the `uint32` size encoded as big endian.
   953  
   954      **PAYLOAD**
   955  
   956      The payload is the raw stream.
   957  
   958      **IMPLEMENTATION**
   959  
   960      The simplest way to implement the Attach protocol is the following:
   961  
   962      1.  Read eight bytes.
   963      2.  Choose `stdout` or `stderr` depending on the first byte.
   964      3.  Extract the frame size from the last four bytes.
   965      4.  Read the extracted size and output it on the correct output.
   966      5.  Goto 1.
   967  
   968  ### Attach to a container (websocket)
   969  
   970  `GET /containers/(id)/attach/ws`
   971  
   972  Attach to the container `id` via websocket
   973  
   974  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
   975  
   976  **Example request**
   977  
   978      GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
   979  
   980  **Example response**
   981  
   982      {{ STREAM }}
   983  
   984  Query Parameters:
   985  
   986  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
   987  -   **stream** – 1/True/true or 0/False/false, return stream.
   988          Default `false`.
   989  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
   990          to `stdin`. Default `false`.
   991  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
   992          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
   993  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
   994          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
   995  
   996  Status Codes:
   997  
   998  -   **200** – no error
   999  -   **400** – bad parameter
  1000  -   **404** – no such container
  1001  -   **500** – server error
  1002  
  1003  ### Wait a container
  1004  
  1005  `POST /containers/(id)/wait`
  1006  
  1007  Block until container `id` stops, then returns the exit code
  1008  
  1009  **Example request**:
  1010  
  1011      POST /containers/16253994b7c4/wait HTTP/1.1
  1012  
  1013  **Example response**:
  1014  
  1015      HTTP/1.1 200 OK
  1016      Content-Type: application/json
  1017  
  1018      {"StatusCode": 0}
  1019  
  1020  Status Codes:
  1021  
  1022  -   **200** – no error
  1023  -   **404** – no such container
  1024  -   **500** – server error
  1025  
  1026  ### Remove a container
  1027  
  1028  `DELETE /containers/(id)`
  1029  
  1030  Remove the container `id` from the filesystem
  1031  
  1032  **Example request**:
  1033  
  1034      DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  1035  
  1036  **Example response**:
  1037  
  1038      HTTP/1.1 204 No Content
  1039  
  1040  Query Parameters:
  1041  
  1042  -   **v** – 1/True/true or 0/False/false, Remove the volumes
  1043          associated to the container. Default `false`.
  1044  -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
  1045          Default `false`.
  1046  
  1047  Status Codes:
  1048  
  1049  -   **204** – no error
  1050  -   **400** – bad parameter
  1051  -   **404** – no such container
  1052  -   **500** – server error
  1053  
  1054  ### Copy files or folders from a container
  1055  
  1056  `POST /containers/(id)/copy`
  1057  
  1058  Copy files or folders of container `id`
  1059  
  1060  **Deprecated** in favor of the `archive` endpoint below.
  1061  
  1062  **Example request**:
  1063  
  1064      POST /containers/4fa6e0f0c678/copy HTTP/1.1
  1065      Content-Type: application/json
  1066  
  1067      {
  1068           "Resource": "test.txt"
  1069      }
  1070  
  1071  **Example response**:
  1072  
  1073      HTTP/1.1 200 OK
  1074      Content-Type: application/x-tar
  1075  
  1076      {{ TAR STREAM }}
  1077  
  1078  Status Codes:
  1079  
  1080  -   **200** – no error
  1081  -   **404** – no such container
  1082  -   **500** – server error
  1083  
  1084  ### Retrieving information about files and folders in a container
  1085  
  1086  `HEAD /containers/(id)/archive`
  1087  
  1088  See the description of the `X-Docker-Container-Path-Stat` header in the
  1089  folowing section.
  1090  
  1091  ### Get an archive of a filesystem resource in a container
  1092  
  1093  `GET /containers/(id)/archive`
  1094  
  1095  Get an tar archive of a resource in the filesystem of container `id`.
  1096  
  1097  Query Parameters:
  1098  
  1099  - **path** - resource in the container's filesystem to archive. Required.
  1100  
  1101      If not an absolute path, it is relative to the container's root directory.
  1102      The resource specified by **path** must exist. To assert that the resource
  1103      is expected to be a directory, **path** should end in `/` or  `/.`
  1104      (assuming a path separator of `/`). If **path** ends in `/.` then this
  1105      indicates that only the contents of the **path** directory should be
  1106      copied. A symlink is always resolved to its target.
  1107  
  1108      **Note**: It is not possible to copy certain system files such as resources
  1109      under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
  1110      container.
  1111  
  1112  **Example request**:
  1113  
  1114          GET /containers/8cce319429b2/archive?path=/root HTTP/1.1
  1115  
  1116  **Example response**:
  1117  
  1118          HTTP/1.1 200 OK
  1119          Content-Type: application/x-tar
  1120          X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
  1121  
  1122          {{ TAR STREAM }}
  1123  
  1124  On success, a response header `X-Docker-Container-Path-Stat` will be set to a
  1125  base64-encoded JSON object containing some filesystem header information about
  1126  the archived resource. The above example value would decode to the following
  1127  JSON object (whitespace added for readability):
  1128  
  1129          {
  1130              "name": "root",
  1131              "size": 4096,
  1132              "mode": 2147484096,
  1133              "mtime": "2014-02-27T20:51:23Z",
  1134              "linkTarget": ""
  1135          }
  1136  
  1137  A `HEAD` request can also be made to this endpoint if only this information is
  1138  desired.
  1139  
  1140  Status Codes:
  1141  
  1142  - **200** - success, returns archive of copied resource
  1143  - **400** - client error, bad parameter, details in JSON response body, one of:
  1144      - must specify path parameter (**path** cannot be empty)
  1145      - not a directory (**path** was asserted to be a directory but exists as a
  1146        file)
  1147  - **404** - client error, resource not found, one of:
  1148      – no such container (container `id` does not exist)
  1149      - no such file or directory (**path** does not exist)
  1150  - **500** - server error
  1151  
  1152  ### Extract an archive of files or folders to a directory in a container
  1153  
  1154  `PUT /containers/(id)/archive`
  1155  
  1156  Upload a tar archive to be extracted to a path in the filesystem of container
  1157  `id`.
  1158  
  1159  Query Parameters:
  1160  
  1161  - **path** - path to a directory in the container
  1162      to extract the archive's contents into. Required.
  1163  
  1164      If not an absolute path, it is relative to the container's root directory.
  1165      The **path** resource must exist.
  1166  - **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
  1167      if unpacking the given content would cause an existing directory to be
  1168      replaced with a non-directory and vice versa.
  1169  
  1170  **Example request**:
  1171  
  1172          PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
  1173          Content-Type: application/x-tar
  1174  
  1175          {{ TAR STREAM }}
  1176  
  1177  **Example response**:
  1178  
  1179          HTTP/1.1 200 OK
  1180  
  1181  Status Codes:
  1182  
  1183  - **200** – the content was extracted successfully
  1184  - **400** - client error, bad parameter, details in JSON response body, one of:
  1185      - must specify path parameter (**path** cannot be empty)
  1186      - not a directory (**path** should be a directory but exists as a file)
  1187      - unable to overwrite existing directory with non-directory
  1188        (if **noOverwriteDirNonDir**)
  1189      - unable to overwrite existing non-directory with directory
  1190        (if **noOverwriteDirNonDir**)
  1191  - **403** - client error, permission denied, the volume
  1192      or container rootfs is marked as read-only.
  1193  - **404** - client error, resource not found, one of:
  1194      – no such container (container `id` does not exist)
  1195      - no such file or directory (**path** resource does not exist)
  1196  - **500** – server error
  1197  
  1198  ## 2.2 Images
  1199  
  1200  ### List Images
  1201  
  1202  `GET /images/json`
  1203  
  1204  **Example request**:
  1205  
  1206      GET /images/json?all=0 HTTP/1.1
  1207  
  1208  **Example response**:
  1209  
  1210      HTTP/1.1 200 OK
  1211      Content-Type: application/json
  1212  
  1213      [
  1214        {
  1215           "RepoTags": [
  1216             "ubuntu:12.04",
  1217             "ubuntu:precise",
  1218             "ubuntu:latest"
  1219           ],
  1220           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
  1221           "Created": 1365714795,
  1222           "Size": 131506275,
  1223           "VirtualSize": 131506275
  1224        },
  1225        {
  1226           "RepoTags": [
  1227             "ubuntu:12.10",
  1228             "ubuntu:quantal"
  1229           ],
  1230           "ParentId": "27cf784147099545",
  1231           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1232           "Created": 1364102658,
  1233           "Size": 24653,
  1234           "VirtualSize": 180116135
  1235        }
  1236      ]
  1237  
  1238  **Example request, with digest information**:
  1239  
  1240      GET /images/json?digests=1 HTTP/1.1
  1241  
  1242  **Example response, with digest information**:
  1243  
  1244      HTTP/1.1 200 OK
  1245      Content-Type: application/json
  1246  
  1247      [
  1248        {
  1249          "Created": 1420064636,
  1250          "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
  1251          "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
  1252          "RepoDigests": [
  1253            "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1254          ],
  1255          "RepoTags": [
  1256            "localhost:5000/test/busybox:latest",
  1257            "playdate:latest"
  1258          ],
  1259          "Size": 0,
  1260          "VirtualSize": 2429728
  1261        }
  1262      ]
  1263  
  1264  The response shows a single image `Id` associated with two repositories
  1265  (`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
  1266  either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
  1267  `playdate:latest` to reference the image.
  1268  
  1269  You can also use `RepoDigests` values to reference an image. In this response,
  1270  the array has only one reference and that is to the
  1271  `localhost:5000/test/busybox` repository; the `playdate` repository has no
  1272  digest. You can reference this digest using the value:
  1273  `localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
  1274  
  1275  See the `docker run` and `docker build` commands for examples of digest and tag
  1276  references on the command line.
  1277  
  1278  Query Parameters:
  1279  
  1280  -   **all** – 1/True/true or 0/False/false, default false
  1281  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  1282    -   `dangling=true`
  1283    -   `label=key` or `label="key=value"` of an image label
  1284  -   **filter** - only return images with the specified name
  1285  
  1286  ### Build image from a Dockerfile
  1287  
  1288  `POST /build`
  1289  
  1290  Build an image from a Dockerfile
  1291  
  1292  **Example request**:
  1293  
  1294      POST /build HTTP/1.1
  1295  
  1296      {{ TAR STREAM }}
  1297  
  1298  **Example response**:
  1299  
  1300      HTTP/1.1 200 OK
  1301      Content-Type: application/json
  1302  
  1303      {"stream": "Step 1..."}
  1304      {"stream": "..."}
  1305      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1306  
  1307  The input stream must be a `tar` archive compressed with one of the
  1308  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1309  
  1310  The archive must include a build instructions file, typically called
  1311  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1312  used to specify a different build instructions file. To do this, its value must be
  1313  the path to the alternate build instructions file to use.
  1314  
  1315  The archive may include any number of other files,
  1316  which are accessible in the build context (See the [*ADD build
  1317  command*](/reference/builder/#dockerbuilder)).
  1318  
  1319  The build is canceled if the client drops the connection by quitting
  1320  or being killed.
  1321  
  1322  Query Parameters:
  1323  
  1324  -   **dockerfile** - Path within the build context to the Dockerfile. This is 
  1325          ignored if `remote` is specified and points to an individual filename.
  1326  -   **t** – A repository name (and optionally a tag) to apply to
  1327          the resulting image in case of success.
  1328  -   **remote** – A Git repository URI or HTTP/HTTPS URI build source. If the 
  1329          URI specifies a filename, the file's contents are placed into a file 
  1330  		called `Dockerfile`.
  1331  -   **q** – Suppress verbose build output.
  1332  -   **nocache** – Do not use the cache when building the image.
  1333  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1334  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1335  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1336  -   **memory** - Set memory limit for build.
  1337  -   **memswap** - Total memory (memory + swap), `-1` to disable swap.
  1338  -   **cpushares** - CPU shares (relative weight).
  1339  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1340  
  1341      Request Headers:
  1342  
  1343  -   **Content-type** – Set to `"application/tar"`.
  1344  -   **X-Registry-Config** – base64-encoded ConfigFile object
  1345  
  1346  Status Codes:
  1347  
  1348  -   **200** – no error
  1349  -   **500** – server error
  1350  
  1351  ### Create an image
  1352  
  1353  `POST /images/create`
  1354  
  1355  Create an image either by pulling it from the registry or by importing it
  1356  
  1357  **Example request**:
  1358  
  1359      POST /images/create?fromImage=ubuntu HTTP/1.1
  1360  
  1361  **Example response**:
  1362  
  1363      HTTP/1.1 200 OK
  1364      Content-Type: application/json
  1365  
  1366      {"status": "Pulling..."}
  1367      {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
  1368      {"error": "Invalid..."}
  1369      ...
  1370  
  1371  When using this endpoint to pull an image from the registry, the
  1372  `X-Registry-Auth` header can be used to include
  1373  a base64-encoded AuthConfig object.
  1374  
  1375  Query Parameters:
  1376  
  1377  -   **fromImage** – Name of the image to pull.
  1378  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1379          can be retrieved or `-` to read the image from the request body.
  1380  -   **repo** – Repository name.
  1381  -   **tag** – Tag.
  1382  -   **registry** – The registry to pull from.
  1383  
  1384      Request Headers:
  1385  
  1386  -   **X-Registry-Auth** – base64-encoded AuthConfig object
  1387  
  1388  Status Codes:
  1389  
  1390  -   **200** – no error
  1391  -   **500** – server error
  1392  
  1393  
  1394  
  1395  ### Inspect an image
  1396  
  1397  `GET /images/(name)/json`
  1398  
  1399  Return low-level information on the image `name`
  1400  
  1401  **Example request**:
  1402  
  1403      GET /images/ubuntu/json HTTP/1.1
  1404  
  1405  **Example response**:
  1406  
  1407      HTTP/1.1 200 OK
  1408      Content-Type: application/json
  1409  
  1410      {
  1411           "Created": "2013-03-23T22:24:18.818426-07:00",
  1412           "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  1413           "ContainerConfig":
  1414                   {
  1415                           "Hostname": "",
  1416                           "User": "",
  1417                           "AttachStdin": false,
  1418                           "AttachStdout": false,
  1419                           "AttachStderr": false,
  1420                           "Tty": true,
  1421                           "OpenStdin": true,
  1422                           "StdinOnce": false,
  1423                           "Env": null,
  1424                           "Cmd": ["/bin/bash"],
  1425                           "Dns": null,
  1426                           "Image": "ubuntu",
  1427                           "Labels": {
  1428                               "com.example.vendor": "Acme",
  1429                               "com.example.license": "GPL",
  1430                               "com.example.version": "1.0"
  1431                           },
  1432                           "Volumes": null,
  1433                           "VolumesFrom": "",
  1434                           "WorkingDir": ""
  1435                   },
  1436           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1437           "Parent": "27cf784147099545",
  1438           "Size": 6824592
  1439      }
  1440  
  1441  Status Codes:
  1442  
  1443  -   **200** – no error
  1444  -   **404** – no such image
  1445  -   **500** – server error
  1446  
  1447  ### Get the history of an image
  1448  
  1449  `GET /images/(name)/history`
  1450  
  1451  Return the history of the image `name`
  1452  
  1453  **Example request**:
  1454  
  1455      GET /images/ubuntu/history HTTP/1.1
  1456  
  1457  **Example response**:
  1458  
  1459      HTTP/1.1 200 OK
  1460      Content-Type: application/json
  1461  
  1462      [
  1463          {
  1464              "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
  1465              "Created": 1398108230,
  1466              "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
  1467              "Tags": [
  1468                  "ubuntu:lucid",
  1469                  "ubuntu:10.04"
  1470              ],
  1471              "Size": 182964289,
  1472              "Comment": ""
  1473          },
  1474          {
  1475              "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
  1476              "Created": 1398108222,
  1477              "CreatedBy": "/bin/sh -c #(nop) MAINTAINER Tianon Gravi <admwiggin@gmail.com> - mkimage-debootstrap.sh -i iproute,iputils-ping,ubuntu-minimal -t lucid.tar.xz lucid http://archive.ubuntu.com/ubuntu/",
  1478              "Tags": null,
  1479              "Size": 0,
  1480              "Comment": ""
  1481          },
  1482          {
  1483              "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
  1484              "Created": 1371157430,
  1485              "CreatedBy": "",
  1486              "Tags": [
  1487                  "scratch12:latest",
  1488                  "scratch:latest"
  1489              ],
  1490              "Size": 0,
  1491              "Comment": "Imported from -"
  1492          }
  1493      ]
  1494  
  1495  Status Codes:
  1496  
  1497  -   **200** – no error
  1498  -   **404** – no such image
  1499  -   **500** – server error
  1500  
  1501  ### Push an image on the registry
  1502  
  1503  `POST /images/(name)/push`
  1504  
  1505  Push the image `name` on the registry
  1506  
  1507  **Example request**:
  1508  
  1509      POST /images/test/push HTTP/1.1
  1510  
  1511  **Example response**:
  1512  
  1513      HTTP/1.1 200 OK
  1514      Content-Type: application/json
  1515  
  1516      {"status": "Pushing..."}
  1517      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  1518      {"error": "Invalid..."}
  1519      ...
  1520  
  1521  If you wish to push an image on to a private registry, that image must already have a tag
  1522  into a repository which references that registry `hostname` and `port`.  This repository name should
  1523  then be used in the URL. This duplicates the command line's flow.
  1524  
  1525  **Example request**:
  1526  
  1527      POST /images/registry.acme.com:5000/test/push HTTP/1.1
  1528  
  1529  
  1530  Query Parameters:
  1531  
  1532  -   **tag** – The tag to associate with the image on the registry. This is optional.
  1533  
  1534  Request Headers:
  1535  
  1536  -   **X-Registry-Auth** – Include a base64-encoded AuthConfig.
  1537          object.
  1538  
  1539  Status Codes:
  1540  
  1541  -   **200** – no error
  1542  -   **404** – no such image
  1543  -   **500** – server error
  1544  
  1545  ### Tag an image into a repository
  1546  
  1547  `POST /images/(name)/tag`
  1548  
  1549  Tag the image `name` into a repository
  1550  
  1551  **Example request**:
  1552  
  1553      POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
  1554  
  1555  **Example response**:
  1556  
  1557      HTTP/1.1 201 OK
  1558  
  1559  Query Parameters:
  1560  
  1561  -   **repo** – The repository to tag in
  1562  -   **force** – 1/True/true or 0/False/false, default false
  1563  -   **tag** - The new tag name
  1564  
  1565  Status Codes:
  1566  
  1567  -   **201** – no error
  1568  -   **400** – bad parameter
  1569  -   **404** – no such image
  1570  -   **409** – conflict
  1571  -   **500** – server error
  1572  
  1573  ### Remove an image
  1574  
  1575  `DELETE /images/(name)`
  1576  
  1577  Remove the image `name` from the filesystem
  1578  
  1579  **Example request**:
  1580  
  1581      DELETE /images/test HTTP/1.1
  1582  
  1583  **Example response**:
  1584  
  1585      HTTP/1.1 200 OK
  1586      Content-type: application/json
  1587  
  1588      [
  1589       {"Untagged": "3e2f21a89f"},
  1590       {"Deleted": "3e2f21a89f"},
  1591       {"Deleted": "53b4f83ac9"}
  1592      ]
  1593  
  1594  Query Parameters:
  1595  
  1596  -   **force** – 1/True/true or 0/False/false, default false
  1597  -   **noprune** – 1/True/true or 0/False/false, default false
  1598  
  1599  Status Codes:
  1600  
  1601  -   **200** – no error
  1602  -   **404** – no such image
  1603  -   **409** – conflict
  1604  -   **500** – server error
  1605  
  1606  ### Search images
  1607  
  1608  `GET /images/search`
  1609  
  1610  Search for an image on [Docker Hub](https://hub.docker.com).
  1611  
  1612  > **Note**:
  1613  > The response keys have changed from API v1.6 to reflect the JSON
  1614  > sent by the registry server to the docker daemon's request.
  1615  
  1616  **Example request**:
  1617  
  1618      GET /images/search?term=sshd HTTP/1.1
  1619  
  1620  **Example response**:
  1621  
  1622      HTTP/1.1 200 OK
  1623      Content-Type: application/json
  1624  
  1625      [
  1626              {
  1627                  "description": "",
  1628                  "is_official": false,
  1629                  "is_automated": false,
  1630                  "name": "wma55/u1210sshd",
  1631                  "star_count": 0
  1632              },
  1633              {
  1634                  "description": "",
  1635                  "is_official": false,
  1636                  "is_automated": false,
  1637                  "name": "jdswinbank/sshd",
  1638                  "star_count": 0
  1639              },
  1640              {
  1641                  "description": "",
  1642                  "is_official": false,
  1643                  "is_automated": false,
  1644                  "name": "vgauthier/sshd",
  1645                  "star_count": 0
  1646              }
  1647      ...
  1648      ]
  1649  
  1650  Query Parameters:
  1651  
  1652  -   **term** – term to search
  1653  
  1654  Status Codes:
  1655  
  1656  -   **200** – no error
  1657  -   **500** – server error
  1658  
  1659  ## 2.3 Misc
  1660  
  1661  ### Check auth configuration
  1662  
  1663  `POST /auth`
  1664  
  1665  Get the default username and email
  1666  
  1667  **Example request**:
  1668  
  1669      POST /auth HTTP/1.1
  1670      Content-Type: application/json
  1671  
  1672      {
  1673           "username":" hannibal",
  1674           "password: "xxxx",
  1675           "email": "hannibal@a-team.com",
  1676           "serveraddress": "https://index.docker.io/v1/"
  1677      }
  1678  
  1679  **Example response**:
  1680  
  1681      HTTP/1.1 200 OK
  1682  
  1683  Status Codes:
  1684  
  1685  -   **200** – no error
  1686  -   **204** – no error
  1687  -   **500** – server error
  1688  
  1689  ### Display system-wide information
  1690  
  1691  `GET /info`
  1692  
  1693  Display system-wide information
  1694  
  1695  **Example request**:
  1696  
  1697      GET /info HTTP/1.1
  1698  
  1699  **Example response**:
  1700  
  1701      HTTP/1.1 200 OK
  1702      Content-Type: application/json
  1703  
  1704      {
  1705          "Containers": 11,
  1706          "CpuCfsPeriod": true,
  1707          "CpuCfsQuota": true,
  1708          "Debug": false,
  1709          "DockerRootDir": "/var/lib/docker",
  1710          "Driver": "btrfs",
  1711          "DriverStatus": [[""]],
  1712          "ExecutionDriver": "native-0.1",
  1713          "ExperimentalBuild": false,
  1714          "HttpProxy": "http://test:test@localhost:8080",
  1715          "HttpsProxy": "https://test:test@localhost:8080",
  1716          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  1717          "IPv4Forwarding": true,
  1718          "Images": 16,
  1719          "IndexServerAddress": "https://index.docker.io/v1/",
  1720          "InitPath": "/usr/bin/docker",
  1721          "InitSha1": "",
  1722          "KernelVersion": "3.12.0-1-amd64",
  1723          "Labels": [
  1724              "storage=ssd"
  1725          ],
  1726          "MemTotal": 2099236864,
  1727          "MemoryLimit": true,
  1728          "NCPU": 1,
  1729          "NEventsListener": 0,
  1730          "NFd": 11,
  1731          "NGoroutines": 21,
  1732          "Name": "prod-server-42",
  1733          "NoProxy": "9.81.1.160",
  1734          "OomKillDisable": true,
  1735          "OperatingSystem": "Boot2Docker",
  1736          "RegistryConfig": {
  1737              "IndexConfigs": {
  1738                  "docker.io": {
  1739                      "Mirrors": null,
  1740                      "Name": "docker.io",
  1741                      "Official": true,
  1742                      "Secure": true
  1743                  }
  1744              },
  1745              "InsecureRegistryCIDRs": [
  1746                  "127.0.0.0/8"
  1747              ]
  1748          },
  1749          "SwapLimit": false,
  1750          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  1751      }
  1752  
  1753  Status Codes:
  1754  
  1755  -   **200** – no error
  1756  -   **500** – server error
  1757  
  1758  ### Show the docker version information
  1759  
  1760  `GET /version`
  1761  
  1762  Show the docker version information
  1763  
  1764  **Example request**:
  1765  
  1766      GET /version HTTP/1.1
  1767  
  1768  **Example response**:
  1769  
  1770      HTTP/1.1 200 OK
  1771      Content-Type: application/json
  1772  
  1773      {
  1774           "Version": "1.5.0",
  1775           "Os": "linux",
  1776           "KernelVersion": "3.18.5-tinycore64",
  1777           "GoVersion": "go1.4.1",
  1778           "GitCommit": "a8a31ef",
  1779           "Arch": "amd64",
  1780           "ApiVersion": "1.20",
  1781           "Experimental": false
  1782      }
  1783  
  1784  Status Codes:
  1785  
  1786  -   **200** – no error
  1787  -   **500** – server error
  1788  
  1789  ### Ping the docker server
  1790  
  1791  `GET /_ping`
  1792  
  1793  Ping the docker server
  1794  
  1795  **Example request**:
  1796  
  1797      GET /_ping HTTP/1.1
  1798  
  1799  **Example response**:
  1800  
  1801      HTTP/1.1 200 OK
  1802      Content-Type: text/plain
  1803  
  1804      OK
  1805  
  1806  Status Codes:
  1807  
  1808  -   **200** - no error
  1809  -   **500** - server error
  1810  
  1811  ### Create a new image from a container's changes
  1812  
  1813  `POST /commit`
  1814  
  1815  Create a new image from a container's changes
  1816  
  1817  **Example request**:
  1818  
  1819      POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  1820      Content-Type: application/json
  1821  
  1822      {
  1823           "Hostname": "",
  1824           "Domainname": "",
  1825           "User": "",
  1826           "AttachStdin": false,
  1827           "AttachStdout": true,
  1828           "AttachStderr": true,
  1829           "Tty": false,
  1830           "OpenStdin": false,
  1831           "StdinOnce": false,
  1832           "Env": null,
  1833           "Cmd": [
  1834                   "date"
  1835           ],
  1836           "Mounts": [
  1837             {
  1838               "Source": "/data",
  1839               "Destination": "/data",
  1840               "Mode": "ro,Z",
  1841               "RW": false
  1842             }
  1843           ],
  1844           "Labels": {
  1845                   "key1": "value1",
  1846                   "key2": "value2"
  1847            },
  1848           "WorkingDir": "",
  1849           "NetworkDisabled": false,
  1850           "ExposedPorts": {
  1851                   "22/tcp": {}
  1852           }
  1853      }
  1854  
  1855  **Example response**:
  1856  
  1857      HTTP/1.1 201 Created
  1858      Content-Type: application/vnd.docker.raw-stream
  1859  
  1860      {"Id": "596069db4bf5"}
  1861  
  1862  Json Parameters:
  1863  
  1864  -  **config** - the container's configuration
  1865  
  1866  Query Parameters:
  1867  
  1868  -   **container** – source container
  1869  -   **repo** – repository
  1870  -   **tag** – tag
  1871  -   **comment** – commit message
  1872  -   **author** – author (e.g., "John Hannibal Smith
  1873      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  1874  
  1875  Status Codes:
  1876  
  1877  -   **201** – no error
  1878  -   **404** – no such container
  1879  -   **500** – server error
  1880  
  1881  ### Monitor Docker's events
  1882  
  1883  `GET /events`
  1884  
  1885  Get container events from docker, either in real time via streaming, or via
  1886  polling (using since).
  1887  
  1888  Docker containers report the following events:
  1889  
  1890      attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause
  1891  
  1892  and Docker images report:
  1893  
  1894      delete, import, pull, push, tag, untag
  1895  
  1896  **Example request**:
  1897  
  1898      GET /events?since=1374067924
  1899  
  1900  **Example response**:
  1901  
  1902      HTTP/1.1 200 OK
  1903      Content-Type: application/json
  1904  
  1905      {"status": "create", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1906      {"status": "start", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067924}
  1907      {"status": "stop", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067966}
  1908      {"status": "destroy", "id": "dfdf82bd3881","from": "ubuntu:latest", "time":1374067970}
  1909  
  1910  Query Parameters:
  1911  
  1912  -   **since** – Timestamp used for polling
  1913  -   **until** – Timestamp used for polling
  1914  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  1915    -   `event=<string>`; -- event to filter
  1916    -   `image=<string>`; -- image to filter
  1917    -   `container=<string>`; -- container to filter
  1918  
  1919  Status Codes:
  1920  
  1921  -   **200** – no error
  1922  -   **500** – server error
  1923  
  1924  ### Get a tarball containing all images in a repository
  1925  
  1926  `GET /images/(name)/get`
  1927  
  1928  Get a tarball containing all images and metadata for the repository specified
  1929  by `name`.
  1930  
  1931  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  1932  (and its parents) are returned. If `name` is an image ID, similarly only that
  1933  image (and its parents) are returned, but with the exclusion of the
  1934  'repositories' file in the tarball, as there were no image names referenced.
  1935  
  1936  See the [image tarball format](#image-tarball-format) for more details.
  1937  
  1938  **Example request**
  1939  
  1940      GET /images/ubuntu/get
  1941  
  1942  **Example response**:
  1943  
  1944      HTTP/1.1 200 OK
  1945      Content-Type: application/x-tar
  1946  
  1947      Binary data stream
  1948  
  1949  Status Codes:
  1950  
  1951  -   **200** – no error
  1952  -   **500** – server error
  1953  
  1954  ### Get a tarball containing all images.
  1955  
  1956  `GET /images/get`
  1957  
  1958  Get a tarball containing all images and metadata for one or more repositories.
  1959  
  1960  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  1961  `ubuntu:latest`), then only that image (and its parents) are returned; if it is
  1962  an image ID, similarly only that image (and its parents) are returned and there
  1963  would be no names referenced in the 'repositories' file for this image ID.
  1964  
  1965  See the [image tarball format](#image-tarball-format) for more details.
  1966  
  1967  **Example request**
  1968  
  1969      GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  1970  
  1971  **Example response**:
  1972  
  1973      HTTP/1.1 200 OK
  1974      Content-Type: application/x-tar
  1975  
  1976      Binary data stream
  1977  
  1978  Status Codes:
  1979  
  1980  -   **200** – no error
  1981  -   **500** – server error
  1982  
  1983  ### Load a tarball with a set of images and tags into docker
  1984  
  1985  `POST /images/load`
  1986  
  1987  Load a set of images and tags into a Docker repository.
  1988  See the [image tarball format](#image-tarball-format) for more details.
  1989  
  1990  **Example request**
  1991  
  1992      POST /images/load
  1993  
  1994      Tarball in body
  1995  
  1996  **Example response**:
  1997  
  1998      HTTP/1.1 200 OK
  1999  
  2000  Status Codes:
  2001  
  2002  -   **200** – no error
  2003  -   **500** – server error
  2004  
  2005  ### Image tarball format
  2006  
  2007  An image tarball contains one directory per image layer (named using its long ID),
  2008  each containing these files:
  2009  
  2010  - `VERSION`: currently `1.0` - the file format version
  2011  - `json`: detailed layer information, similar to `docker inspect layer_id`
  2012  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  2013  
  2014  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  2015  for storing attribute changes and deletions.
  2016  
  2017  If the tarball defines a repository, the tarball should also include a `repositories` file at
  2018  the root that contains a list of repository and tag names mapped to layer IDs.
  2019  
  2020  ```
  2021  {"hello-world":
  2022      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  2023  }
  2024  ```
  2025  
  2026  ### Exec Create
  2027  
  2028  `POST /containers/(id)/exec`
  2029  
  2030  Sets up an exec instance in a running container `id`
  2031  
  2032  **Example request**:
  2033  
  2034      POST /containers/e90e34656806/exec HTTP/1.1
  2035      Content-Type: application/json
  2036  
  2037        {
  2038         "AttachStdin": false,
  2039         "AttachStdout": true,
  2040         "AttachStderr": true,
  2041         "Tty": false,
  2042         "Cmd": [
  2043                       "date"
  2044               ]
  2045        }
  2046  
  2047  **Example response**:
  2048  
  2049      HTTP/1.1 201 OK
  2050      Content-Type: application/json
  2051  
  2052      {
  2053           "Id": "f90e34656806"
  2054           "Warnings":[]
  2055      }
  2056  
  2057  Json Parameters:
  2058  
  2059  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  2060  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  2061  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  2062  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2063  -   **Cmd** - Command to run specified as a string or an array of strings.
  2064  
  2065  
  2066  Status Codes:
  2067  
  2068  -   **201** – no error
  2069  -   **404** – no such container
  2070  
  2071  ### Exec Start
  2072  
  2073  `POST /exec/(id)/start`
  2074  
  2075  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  2076  returns after starting the `exec` command. Otherwise, this API sets up an
  2077  interactive session with the `exec` command.
  2078  
  2079  **Example request**:
  2080  
  2081      POST /exec/e90e34656806/start HTTP/1.1
  2082      Content-Type: application/json
  2083  
  2084      {
  2085       "Detach": false,
  2086       "Tty": false
  2087      }
  2088  
  2089  **Example response**:
  2090  
  2091      HTTP/1.1 201 OK
  2092      Content-Type: application/json
  2093  
  2094      {{ STREAM }}
  2095  
  2096  Json Parameters:
  2097  
  2098  -   **Detach** - Detach from the `exec` command.
  2099  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2100  
  2101  Status Codes:
  2102  
  2103  -   **201** – no error
  2104  -   **404** – no such exec instance
  2105  
  2106      **Stream details**:
  2107      Similar to the stream behavior of `POST /container/(id)/attach` API
  2108  
  2109  ### Exec Resize
  2110  
  2111  `POST /exec/(id)/resize`
  2112  
  2113  Resizes the `tty` session used by the `exec` command `id`.
  2114  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  2115  
  2116  **Example request**:
  2117  
  2118      POST /exec/e90e34656806/resize HTTP/1.1
  2119      Content-Type: text/plain
  2120  
  2121  **Example response**:
  2122  
  2123      HTTP/1.1 201 OK
  2124      Content-Type: text/plain
  2125  
  2126  Query Parameters:
  2127  
  2128  -   **h** – height of `tty` session
  2129  -   **w** – width
  2130  
  2131  Status Codes:
  2132  
  2133  -   **201** – no error
  2134  -   **404** – no such exec instance
  2135  
  2136  ### Exec Inspect
  2137  
  2138  `GET /exec/(id)/json`
  2139  
  2140  Return low-level information about the `exec` command `id`.
  2141  
  2142  **Example request**:
  2143  
  2144      GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  2145  
  2146  **Example response**:
  2147  
  2148      HTTP/1.1 200 OK
  2149      Content-Type: plain/text
  2150  
  2151      {
  2152        "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
  2153        "Running" : false,
  2154        "ExitCode" : 2,
  2155        "ProcessConfig" : {
  2156          "privileged" : false,
  2157          "user" : "",
  2158          "tty" : false,
  2159          "entrypoint" : "sh",
  2160          "arguments" : [
  2161            "-c",
  2162            "exit 2"
  2163          ]
  2164        },
  2165        "OpenStdin" : false,
  2166        "OpenStderr" : false,
  2167        "OpenStdout" : false,
  2168        "Container" : {
  2169          "State" : {
  2170            "Running" : true,
  2171            "Paused" : false,
  2172            "Restarting" : false,
  2173            "OOMKilled" : false,
  2174            "Pid" : 3650,
  2175            "ExitCode" : 0,
  2176            "Error" : "",
  2177            "StartedAt" : "2014-11-17T22:26:03.717657531Z",
  2178            "FinishedAt" : "0001-01-01T00:00:00Z"
  2179          },
  2180          "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
  2181          "Created" : "2014-11-17T22:26:03.626304998Z",
  2182          "Path" : "date",
  2183          "Args" : [],
  2184          "Config" : {
  2185            "Hostname" : "8f177a186b97",
  2186            "Domainname" : "",
  2187            "User" : "",
  2188            "AttachStdin" : false,
  2189            "AttachStdout" : false,
  2190            "AttachStderr" : false,
  2191            "ExposedPorts" : null,
  2192            "Tty" : false,
  2193            "OpenStdin" : false,
  2194            "StdinOnce" : false,
  2195            "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
  2196            "Cmd" : [
  2197              "date"
  2198            ],
  2199            "Image" : "ubuntu",
  2200            "Volumes" : null,
  2201            "WorkingDir" : "",
  2202            "Entrypoint" : null,
  2203            "NetworkDisabled" : false,
  2204            "MacAddress" : "",
  2205            "OnBuild" : null,
  2206            "SecurityOpt" : null
  2207          },
  2208          "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
  2209          "NetworkSettings" : {
  2210            "IPAddress" : "172.17.0.2",
  2211            "IPPrefixLen" : 16,
  2212            "MacAddress" : "02:42:ac:11:00:02",
  2213            "Gateway" : "172.17.42.1",
  2214            "Bridge" : "docker0",
  2215            "PortMapping" : null,
  2216            "Ports" : {}
  2217          },
  2218          "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
  2219          "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
  2220          "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
  2221          "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
  2222          "Name" : "/test",
  2223          "Driver" : "aufs",
  2224          "ExecDriver" : "native-0.2",
  2225          "MountLabel" : "",
  2226          "ProcessLabel" : "",
  2227          "AppArmorProfile" : "",
  2228          "RestartCount" : 0,
  2229          "Mounts" : [],
  2230        }
  2231      }
  2232  
  2233  Status Codes:
  2234  
  2235  -   **200** – no error
  2236  -   **404** – no such exec instance
  2237  -   **500** - server error
  2238  
  2239  # 3. Going further
  2240  
  2241  ## 3.1 Inside `docker run`
  2242  
  2243  As an example, the `docker run` command line makes the following API calls:
  2244  
  2245  - Create the container
  2246  
  2247  - If the status code is 404, it means the image doesn't exist:
  2248      - Try to pull it.
  2249      - Then, retry to create the container.
  2250  
  2251  - Start the container.
  2252  
  2253  - If you are not in detached mode:
  2254  - Attach to the container, using `logs=1` (to have `stdout` and
  2255        `stderr` from the container's start) and `stream=1`
  2256  
  2257  - If in detached mode or only `stdin` is attached, display the container's id.
  2258  
  2259  ## 3.2 Hijacking
  2260  
  2261  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  2262  `stdout`, and `stderr` on the same socket.
  2263  
  2264  To hint potential proxies about connection hijacking, Docker client sends
  2265  connection upgrade headers similarly to websocket.
  2266  
  2267      Upgrade: tcp
  2268      Connection: Upgrade
  2269  
  2270  When Docker daemon detects the `Upgrade` header, it switches its status code
  2271  from **200 OK** to **101 UPGRADED** and resends the same headers.
  2272  
  2273  
  2274  ## 3.3 CORS Requests
  2275  
  2276  To set cross origin requests to the remote api please give values to 
  2277  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  2278  default or blank means CORS disabled
  2279  
  2280      $ docker daemon -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"