github.com/guilhermebr/docker@v1.4.2-0.20150428121140-67da055cebca/docs/sources/reference/api/docker_remote_api_v1.18.md (about)

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