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