github.com/olljanat/moby@v1.13.1/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  
  1196      {% raw %}
  1197      {{ TAR STREAM }}
  1198      {% endraw %}
  1199  
  1200  **Example response**:
  1201  
  1202      HTTP/1.1 200 OK
  1203      Content-Type: application/json
  1204  
  1205      {"stream": "Step 1/5..."}
  1206      {"stream": "..."}
  1207      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1208  
  1209  The input stream must be a `tar` archive compressed with one of the
  1210  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1211  
  1212  The archive must include a build instructions file, typically called
  1213  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1214  used to specify a different build instructions file. To do this, its value must be
  1215  the path to the alternate build instructions file to use.
  1216  
  1217  The archive may include any number of other files,
  1218  which are accessible in the build context (See the [*ADD build
  1219  command*](../reference/builder.md#add)).
  1220  
  1221  The Docker daemon performs a preliminary validation of the `Dockerfile` before
  1222  starting the build, and returns an error if the syntax is incorrect. After that,
  1223  each instruction is run one-by-one until the ID of the new image is output.
  1224  
  1225  The build is canceled if the client drops the connection by quitting
  1226  or being killed.
  1227  
  1228  **Query parameters**:
  1229  
  1230  -   **dockerfile** - Path within the build context to the Dockerfile. This is
  1231          ignored if `remote` is specified and points to an individual filename.
  1232  -   **t** – A name and optional tag to apply to the image in the `name:tag` format.
  1233          If you omit the `tag` the default `latest` value is assumed.
  1234  -   **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
  1235          URI points to a single text file, the file's contents are placed into
  1236          a file called `Dockerfile` and the image is built from that file.
  1237  -   **q** – Suppress verbose build output.
  1238  -   **nocache** – Do not use the cache when building the image.
  1239  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1240  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1241  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1242  -   **memory** - Set memory limit for build.
  1243  -   **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
  1244  -   **cpushares** - CPU shares (relative weight).
  1245  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1246  
  1247  **Request Headers**:
  1248  
  1249  -   **Content-type** – Set to `"application/tar"`.
  1250  -   **X-Registry-Config** – base64-encoded ConfigFile object
  1251  
  1252  **Status codes**:
  1253  
  1254  -   **200** – no error
  1255  -   **500** – server error
  1256  
  1257  #### Create an image
  1258  
  1259  `POST /images/create`
  1260  
  1261  Create an image either by pulling it from the registry or by importing it
  1262  
  1263  **Example request**:
  1264  
  1265      POST /v1.18/images/create?fromImage=busybox&tag=latest HTTP/1.1
  1266  
  1267  **Example response**:
  1268  
  1269      HTTP/1.1 200 OK
  1270      Content-Type: application/json
  1271  
  1272      {"status": "Pulling..."}
  1273      {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
  1274      {"error": "Invalid..."}
  1275      ...
  1276  
  1277  When using this endpoint to pull an image from the registry, the
  1278  `X-Registry-Auth` header can be used to include
  1279  a base64-encoded AuthConfig object.
  1280  
  1281  **Query parameters**:
  1282  
  1283  -   **fromImage** – Name of the image to pull.
  1284  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1285          can be retrieved or `-` to read the image from the request body.
  1286  -   **repo** – Repository name.
  1287  -   **tag** – Tag. If empty when pulling an image, this causes all tags
  1288          for the given image to be pulled.
  1289  
  1290  **Request Headers**:
  1291  
  1292  -   **X-Registry-Auth** – base64-encoded AuthConfig object
  1293  
  1294  **Status codes**:
  1295  
  1296  -   **200** – no error
  1297  -   **404** - repository does not exist or no read access
  1298  -   **500** – server error
  1299  
  1300  
  1301  
  1302  #### Inspect an image
  1303  
  1304  `GET /images/(name)/json`
  1305  
  1306  Return low-level information on the image `name`
  1307  
  1308  **Example request**:
  1309  
  1310      GET /v1.18/images/ubuntu/json HTTP/1.1
  1311  
  1312  **Example response**:
  1313  
  1314      HTTP/1.1 200 OK
  1315      Content-Type: application/json
  1316  
  1317      {
  1318         "Created": "2013-03-23T22:24:18.818426-07:00",
  1319         "Container": "3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  1320         "ContainerConfig": {
  1321            "Hostname": "",
  1322            "User": "",
  1323            "AttachStdin": false,
  1324            "AttachStdout": false,
  1325            "AttachStderr": false,
  1326            "Tty": true,
  1327            "OpenStdin": true,
  1328            "StdinOnce": false,
  1329            "Env": null,
  1330            "Cmd": ["/bin/bash"],
  1331            "Dns": null,
  1332            "Image": "ubuntu",
  1333            "Labels": {
  1334               "com.example.vendor": "Acme",
  1335               "com.example.license": "GPL",
  1336               "com.example.version": "1.0"
  1337            },
  1338            "Volumes": null,
  1339            "VolumesFrom": "",
  1340            "WorkingDir": ""
  1341         },
  1342         "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1343         "Parent": "27cf784147099545",
  1344         "Size": 6824592
  1345      }
  1346  
  1347  **Status codes**:
  1348  
  1349  -   **200** – no error
  1350  -   **404** – no such image
  1351  -   **500** – server error
  1352  
  1353  #### Get the history of an image
  1354  
  1355  `GET /images/(name)/history`
  1356  
  1357  Return the history of the image `name`
  1358  
  1359  **Example request**:
  1360  
  1361      GET /v1.18/images/ubuntu/history HTTP/1.1
  1362  
  1363  **Example response**:
  1364  
  1365      HTTP/1.1 200 OK
  1366      Content-Type: application/json
  1367  
  1368      [
  1369          {
  1370              "Id": "b750fe79269d",
  1371              "Created": 1364102658,
  1372              "CreatedBy": "/bin/bash"
  1373          },
  1374          {
  1375              "Id": "27cf78414709",
  1376              "Created": 1364068391,
  1377              "CreatedBy": ""
  1378          }
  1379      ]
  1380  
  1381  **Status codes**:
  1382  
  1383  -   **200** – no error
  1384  -   **404** – no such image
  1385  -   **500** – server error
  1386  
  1387  #### Push an image on the registry
  1388  
  1389  `POST /images/(name)/push`
  1390  
  1391  Push the image `name` on the registry
  1392  
  1393  **Example request**:
  1394  
  1395      POST /v1.18/images/test/push HTTP/1.1
  1396  
  1397  **Example response**:
  1398  
  1399      HTTP/1.1 200 OK
  1400      Content-Type: application/json
  1401  
  1402      {"status": "Pushing..."}
  1403      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  1404      {"error": "Invalid..."}
  1405      ...
  1406  
  1407  If you wish to push an image on to a private registry, that image must already have a tag
  1408  into a repository which references that registry `hostname` and `port`.  This repository name should
  1409  then be used in the URL. This duplicates the command line's flow.
  1410  
  1411  **Example request**:
  1412  
  1413      POST /v1.18/images/registry.acme.com:5000/test/push HTTP/1.1
  1414  
  1415  
  1416  **Query parameters**:
  1417  
  1418  -   **tag** – The tag to associate with the image on the registry. This is optional.
  1419  
  1420  **Request Headers**:
  1421  
  1422  -   **X-Registry-Auth** – base64-encoded AuthConfig object.
  1423  
  1424  **Status codes**:
  1425  
  1426  -   **200** – no error
  1427  -   **404** – no such image
  1428  -   **500** – server error
  1429  
  1430  #### Tag an image into a repository
  1431  
  1432  `POST /images/(name)/tag`
  1433  
  1434  Tag the image `name` into a repository
  1435  
  1436  **Example request**:
  1437  
  1438      POST /v1.18/images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
  1439  
  1440  **Example response**:
  1441  
  1442      HTTP/1.1 201 Created
  1443  
  1444  **Query parameters**:
  1445  
  1446  -   **repo** – The repository to tag in
  1447  -   **force** – 1/True/true or 0/False/false, default false
  1448  -   **tag** - The new tag name
  1449  
  1450  **Status codes**:
  1451  
  1452  -   **201** – no error
  1453  -   **400** – bad parameter
  1454  -   **404** – no such image
  1455  -   **409** – conflict
  1456  -   **500** – server error
  1457  
  1458  #### Remove an image
  1459  
  1460  `DELETE /images/(name)`
  1461  
  1462  Remove the image `name` from the filesystem
  1463  
  1464  **Example request**:
  1465  
  1466      DELETE /v1.18/images/test HTTP/1.1
  1467  
  1468  **Example response**:
  1469  
  1470      HTTP/1.1 200 OK
  1471      Content-type: application/json
  1472  
  1473      [
  1474       {"Untagged": "3e2f21a89f"},
  1475       {"Deleted": "3e2f21a89f"},
  1476       {"Deleted": "53b4f83ac9"}
  1477      ]
  1478  
  1479  **Query parameters**:
  1480  
  1481  -   **force** – 1/True/true or 0/False/false, default false
  1482  -   **noprune** – 1/True/true or 0/False/false, default false
  1483  
  1484  **Status codes**:
  1485  
  1486  -   **200** – no error
  1487  -   **404** – no such image
  1488  -   **409** – conflict
  1489  -   **500** – server error
  1490  
  1491  #### Search images
  1492  
  1493  `GET /images/search`
  1494  
  1495  Search for an image on [Docker Hub](https://hub.docker.com).
  1496  
  1497  > **Note**:
  1498  > The response keys have changed from API v1.6 to reflect the JSON
  1499  > sent by the registry server to the docker daemon's request.
  1500  
  1501  **Example request**:
  1502  
  1503      GET /v1.18/images/search?term=sshd HTTP/1.1
  1504  
  1505  **Example response**:
  1506  
  1507      HTTP/1.1 200 OK
  1508      Content-Type: application/json
  1509  
  1510      [
  1511              {
  1512                  "star_count": 12,
  1513                  "is_official": false,
  1514                  "name": "wma55/u1210sshd",
  1515                  "is_automated": false,
  1516                  "description": ""
  1517              },
  1518              {
  1519                  "star_count": 10,
  1520                  "is_official": false,
  1521                  "name": "jdswinbank/sshd",
  1522                  "is_automated": false,
  1523                  "description": ""
  1524              },
  1525              {
  1526                  "star_count": 18,
  1527                  "is_official": false,
  1528                  "name": "vgauthier/sshd",
  1529                  "is_automated": false,
  1530                  "description": ""
  1531              }
  1532      ...
  1533      ]
  1534  
  1535  **Query parameters**:
  1536  
  1537  -   **term** – term to search
  1538  
  1539  **Status codes**:
  1540  
  1541  -   **200** – no error
  1542  -   **500** – server error
  1543  
  1544  ### 2.3 Misc
  1545  
  1546  #### Check auth configuration
  1547  
  1548  `POST /auth`
  1549  
  1550  Get the default username and email
  1551  
  1552  **Example request**:
  1553  
  1554      POST /v1.18/auth HTTP/1.1
  1555      Content-Type: application/json
  1556  
  1557      {
  1558           "username": "hannibal",
  1559           "password": "xxxx",
  1560           "email": "hannibal@a-team.com",
  1561           "serveraddress": "https://index.docker.io/v1/"
  1562      }
  1563  
  1564  **Example response**:
  1565  
  1566      HTTP/1.1 200 OK
  1567  
  1568  **Status codes**:
  1569  
  1570  -   **200** – no error
  1571  -   **204** – no error
  1572  -   **500** – server error
  1573  
  1574  #### Display system-wide information
  1575  
  1576  `GET /info`
  1577  
  1578  Display system-wide information
  1579  
  1580  **Example request**:
  1581  
  1582      GET /v1.18/info HTTP/1.1
  1583  
  1584  **Example response**:
  1585  
  1586      HTTP/1.1 200 OK
  1587      Content-Type: application/json
  1588  
  1589      {
  1590          "Containers": 11,
  1591          "Debug": 0,
  1592          "DockerRootDir": "/var/lib/docker",
  1593          "Driver": "btrfs",
  1594          "DriverStatus": [[""]],
  1595          "ExecutionDriver": "native-0.1",
  1596          "HttpProxy": "http://test:test@localhost:8080",
  1597          "HttpsProxy": "https://test:test@localhost:8080",
  1598          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  1599          "IPv4Forwarding": 1,
  1600          "Images": 16,
  1601          "IndexServerAddress": "https://index.docker.io/v1/",
  1602          "InitPath": "/usr/bin/docker",
  1603          "InitSha1": "",
  1604          "KernelVersion": "3.12.0-1-amd64",
  1605          "Labels": [
  1606              "storage=ssd"
  1607          ],
  1608          "MemTotal": 2099236864,
  1609          "MemoryLimit": 1,
  1610          "NCPU": 1,
  1611          "NEventsListener": 0,
  1612          "NFd": 11,
  1613          "NGoroutines": 21,
  1614          "Name": "prod-server-42",
  1615          "NoProxy": "9.81.1.160",
  1616          "OperatingSystem": "Boot2Docker",
  1617          "RegistryConfig": {
  1618              "IndexConfigs": {
  1619                  "docker.io": {
  1620                      "Mirrors": null,
  1621                      "Name": "docker.io",
  1622                      "Official": true,
  1623                      "Secure": true
  1624                  }
  1625              },
  1626              "InsecureRegistryCIDRs": [
  1627                  "127.0.0.0/8"
  1628              ]
  1629          },
  1630          "SwapLimit": 0,
  1631          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  1632      }
  1633  
  1634  **Status codes**:
  1635  
  1636  -   **200** – no error
  1637  -   **500** – server error
  1638  
  1639  #### Show the docker version information
  1640  
  1641  `GET /version`
  1642  
  1643  Show the docker version information
  1644  
  1645  **Example request**:
  1646  
  1647      GET /v1.18/version HTTP/1.1
  1648  
  1649  **Example response**:
  1650  
  1651      HTTP/1.1 200 OK
  1652      Content-Type: application/json
  1653  
  1654      {
  1655           "Version": "1.5.0",
  1656           "Os": "linux",
  1657           "KernelVersion": "3.18.5-tinycore64",
  1658           "GoVersion": "go1.4.1",
  1659           "GitCommit": "a8a31ef",
  1660           "Arch": "amd64",
  1661           "ApiVersion": "1.18"
  1662      }
  1663  
  1664  **Status codes**:
  1665  
  1666  -   **200** – no error
  1667  -   **500** – server error
  1668  
  1669  #### Ping the docker server
  1670  
  1671  `GET /_ping`
  1672  
  1673  Ping the docker server
  1674  
  1675  **Example request**:
  1676  
  1677      GET /v1.18/_ping HTTP/1.1
  1678  
  1679  **Example response**:
  1680  
  1681      HTTP/1.1 200 OK
  1682      Content-Type: text/plain
  1683  
  1684      OK
  1685  
  1686  **Status codes**:
  1687  
  1688  -   **200** - no error
  1689  -   **500** - server error
  1690  
  1691  #### Create a new image from a container's changes
  1692  
  1693  `POST /commit`
  1694  
  1695  Create a new image from a container's changes
  1696  
  1697  **Example request**:
  1698  
  1699      POST /v1.18/commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  1700      Content-Type: application/json
  1701  
  1702      {
  1703           "Hostname": "",
  1704           "Domainname": "",
  1705           "User": "",
  1706           "AttachStdin": false,
  1707           "AttachStdout": true,
  1708           "AttachStderr": true,
  1709           "PortSpecs": null,
  1710           "Tty": false,
  1711           "OpenStdin": false,
  1712           "StdinOnce": false,
  1713           "Env": null,
  1714           "Cmd": [
  1715                   "date"
  1716           ],
  1717           "Volumes": {
  1718                   "/tmp": {}
  1719           },
  1720           "WorkingDir": "",
  1721           "NetworkDisabled": false,
  1722           "ExposedPorts": {
  1723                   "22/tcp": {}
  1724           }
  1725      }
  1726  
  1727  **Example response**:
  1728  
  1729      HTTP/1.1 201 Created
  1730      Content-Type: application/json
  1731  
  1732      {"Id": "596069db4bf5"}
  1733  
  1734  **JSON parameters**:
  1735  
  1736  -  **config** - the container's configuration
  1737  
  1738  **Query parameters**:
  1739  
  1740  -   **container** – source container
  1741  -   **repo** – repository
  1742  -   **tag** – tag
  1743  -   **comment** – commit message
  1744  -   **author** – author (e.g., "John Hannibal Smith
  1745      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  1746  
  1747  **Status codes**:
  1748  
  1749  -   **201** – no error
  1750  -   **404** – no such container
  1751  -   **500** – server error
  1752  
  1753  #### Monitor Docker's events
  1754  
  1755  `GET /events`
  1756  
  1757  Get container events from docker, in real time via streaming.
  1758  
  1759  Docker containers report the following events:
  1760  
  1761      create, destroy, die, exec_create, exec_start, export, kill, oom, pause, restart, start, stop, unpause
  1762  
  1763  Docker images report the following events:
  1764  
  1765      untag, delete
  1766  
  1767  **Example request**:
  1768  
  1769      GET /v1.18/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. Show all events created since timestamp and then stream
  1784  -   **until** – Timestamp. Show events created until given timestamp and stop streaming
  1785  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  1786    -   `container=<string>`; -- container to filter
  1787    -   `event=<string>`; -- event to filter
  1788    -   `image=<string>`; -- image 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 /v1.18/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 /v1.18/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 /v1.18/images/load
  1864      Content-Type: application/x-tar
  1865  
  1866      Tarball in body
  1867  
  1868  **Example response**:
  1869  
  1870      HTTP/1.1 200 OK
  1871  
  1872  **Status codes**:
  1873  
  1874  -   **200** – no error
  1875  -   **500** – server error
  1876  
  1877  #### Image tarball format
  1878  
  1879  An image tarball contains one directory per image layer (named using its long ID),
  1880  each containing these files:
  1881  
  1882  - `VERSION`: currently `1.0` - the file format version
  1883  - `json`: detailed layer information, similar to `docker inspect layer_id`
  1884  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  1885  
  1886  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  1887  for storing attribute changes and deletions.
  1888  
  1889  If the tarball defines a repository, the tarball should also include a `repositories` file at
  1890  the root that contains a list of repository and tag names mapped to layer IDs.
  1891  
  1892  ```
  1893  {"hello-world":
  1894      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  1895  }
  1896  ```
  1897  
  1898  #### Exec Create
  1899  
  1900  `POST /containers/(id or name)/exec`
  1901  
  1902  Sets up an exec instance in a running container `id`
  1903  
  1904  **Example request**:
  1905  
  1906      POST /v1.18/containers/e90e34656806/exec HTTP/1.1
  1907      Content-Type: application/json
  1908  
  1909      {
  1910        "AttachStdin": true,
  1911        "AttachStdout": true,
  1912        "AttachStderr": true,
  1913        "Cmd": ["sh"],
  1914        "Tty": true
  1915      }
  1916  
  1917  **Example response**:
  1918  
  1919      HTTP/1.1 201 Created
  1920      Content-Type: application/json
  1921  
  1922      {
  1923           "Id": "f90e34656806",
  1924           "Warnings":[]
  1925      }
  1926  
  1927  **JSON parameters**:
  1928  
  1929  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  1930  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  1931  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  1932  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  1933  -   **Cmd** - Command to run specified as a string or an array of strings.
  1934  
  1935  
  1936  **Status codes**:
  1937  
  1938  -   **201** – no error
  1939  -   **404** – no such container
  1940  
  1941  #### Exec Start
  1942  
  1943  `POST /exec/(id)/start`
  1944  
  1945  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  1946  returns after starting the `exec` command. Otherwise, this API sets up an
  1947  interactive session with the `exec` command.
  1948  
  1949  **Example request**:
  1950  
  1951      POST /v1.18/exec/e90e34656806/start HTTP/1.1
  1952      Content-Type: application/json
  1953  
  1954      {
  1955       "Detach": false,
  1956       "Tty": false
  1957      }
  1958  
  1959  **Example response**:
  1960  
  1961      HTTP/1.1 200 OK
  1962      Content-Type: application/vnd.docker.raw-stream
  1963  
  1964      {% raw %}
  1965      {{ STREAM }}
  1966      {% endraw %}
  1967  
  1968  **JSON parameters**:
  1969  
  1970  -   **Detach** - Detach from the `exec` command.
  1971  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  1972  
  1973  **Status codes**:
  1974  
  1975  -   **200** – no error
  1976  -   **404** – no such exec instance
  1977  
  1978  **Stream details**:
  1979  
  1980  Similar to the stream behavior of `POST /containers/(id or name)/attach` API
  1981  
  1982  #### Exec Resize
  1983  
  1984  `POST /exec/(id)/resize`
  1985  
  1986  Resizes the `tty` session used by the `exec` command `id`.  The unit is number of characters.
  1987  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  1988  
  1989  **Example request**:
  1990  
  1991      POST /v1.18/exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
  1992      Content-Type: text/plain
  1993  
  1994  **Example response**:
  1995  
  1996      HTTP/1.1 201 Created
  1997      Content-Type: text/plain
  1998  
  1999  **Query parameters**:
  2000  
  2001  -   **h** – height of `tty` session
  2002  -   **w** – width
  2003  
  2004  **Status codes**:
  2005  
  2006  -   **201** – no error
  2007  -   **404** – no such exec instance
  2008  
  2009  #### Exec Inspect
  2010  
  2011  `GET /exec/(id)/json`
  2012  
  2013  Return low-level information about the `exec` command `id`.
  2014  
  2015  **Example request**:
  2016  
  2017      GET /v1.18/exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  2018  
  2019  **Example response**:
  2020  
  2021      HTTP/1.1 200 OK
  2022      Content-Type: plain/text
  2023  
  2024      {
  2025        "ID" : "11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39",
  2026        "Running" : false,
  2027        "ExitCode" : 2,
  2028        "ProcessConfig" : {
  2029          "privileged" : false,
  2030          "user" : "",
  2031          "tty" : false,
  2032          "entrypoint" : "sh",
  2033          "arguments" : [
  2034            "-c",
  2035            "exit 2"
  2036          ]
  2037        },
  2038        "OpenStdin" : false,
  2039        "OpenStderr" : false,
  2040        "OpenStdout" : false,
  2041        "Container" : {
  2042          "State" : {
  2043            "Running" : true,
  2044            "Paused" : false,
  2045            "Restarting" : false,
  2046            "OOMKilled" : false,
  2047            "Pid" : 3650,
  2048            "ExitCode" : 0,
  2049            "Error" : "",
  2050            "StartedAt" : "2014-11-17T22:26:03.717657531Z",
  2051            "FinishedAt" : "0001-01-01T00:00:00Z"
  2052          },
  2053          "ID" : "8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c",
  2054          "Created" : "2014-11-17T22:26:03.626304998Z",
  2055          "Path" : "date",
  2056          "Args" : [],
  2057          "Config" : {
  2058            "Hostname" : "8f177a186b97",
  2059            "Domainname" : "",
  2060            "User" : "",
  2061            "AttachStdin" : false,
  2062            "AttachStdout" : false,
  2063            "AttachStderr" : false,
  2064            "PortSpecs": null,
  2065            "ExposedPorts" : null,
  2066            "Tty" : false,
  2067            "OpenStdin" : false,
  2068            "StdinOnce" : false,
  2069            "Env" : [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ],
  2070            "Cmd" : [
  2071              "date"
  2072            ],
  2073            "Image" : "ubuntu",
  2074            "Volumes" : null,
  2075            "WorkingDir" : "",
  2076            "Entrypoint" : null,
  2077            "NetworkDisabled" : false,
  2078            "MacAddress" : "",
  2079            "OnBuild" : null,
  2080            "SecurityOpt" : null
  2081          },
  2082          "Image" : "5506de2b643be1e6febbf3b8a240760c6843244c41e12aa2f60ccbb7153d17f5",
  2083          "NetworkSettings" : {
  2084            "IPAddress" : "172.17.0.2",
  2085            "IPPrefixLen" : 16,
  2086            "MacAddress" : "02:42:ac:11:00:02",
  2087            "Gateway" : "172.17.42.1",
  2088            "Bridge" : "docker0",
  2089            "PortMapping" : null,
  2090            "Ports" : {}
  2091          },
  2092          "ResolvConfPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/resolv.conf",
  2093          "HostnamePath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hostname",
  2094          "HostsPath" : "/var/lib/docker/containers/8f177a186b977fb451136e0fdf182abff5599a08b3c7f6ef0d36a55aaf89634c/hosts",
  2095          "LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
  2096          "Name" : "/test",
  2097          "Driver" : "aufs",
  2098          "ExecDriver" : "native-0.2",
  2099          "MountLabel" : "",
  2100          "ProcessLabel" : "",
  2101          "AppArmorProfile" : "",
  2102          "RestartCount" : 0,
  2103          "Volumes" : {},
  2104          "VolumesRW" : {}
  2105        }
  2106      }
  2107  
  2108  **Status codes**:
  2109  
  2110  -   **200** – no error
  2111  -   **404** – no such exec instance
  2112  -   **500** - server error
  2113  
  2114  ## 3. Going further
  2115  
  2116  ### 3.1 Inside `docker run`
  2117  
  2118  As an example, the `docker run` command line makes the following API calls:
  2119  
  2120  - Create the container
  2121  
  2122  - If the status code is 404, it means the image doesn't exist:
  2123      - Try to pull it.
  2124      - Then, retry to create the container.
  2125  
  2126  - Start the container.
  2127  
  2128  - If you are not in detached mode:
  2129  - Attach to the container, using `logs=1` (to have `stdout` and
  2130        `stderr` from the container's start) and `stream=1`
  2131  
  2132  - If in detached mode or only `stdin` is attached, display the container's id.
  2133  
  2134  ### 3.2 Hijacking
  2135  
  2136  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  2137  `stdout`, and `stderr` on the same socket.
  2138  
  2139  To hint potential proxies about connection hijacking, Docker client sends
  2140  connection upgrade headers similarly to websocket.
  2141  
  2142      Upgrade: tcp
  2143      Connection: Upgrade
  2144  
  2145  When Docker daemon detects the `Upgrade` header, it switches its status code
  2146  from **200 OK** to **101 UPGRADED** and resends the same headers.
  2147  
  2148  This might change in the future.
  2149  
  2150  ### 3.3 CORS Requests
  2151  
  2152  To set cross origin requests to the Engine API please give values to
  2153  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  2154  default or blank means CORS disabled
  2155  
  2156      $ docker -d -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"