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

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