github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/api/v1.18.md (about)

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