github.com/slene/docker@v1.8.0-rc1/docs/reference/api/docker_remote_api_v1.19.md (about)

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