github.com/kim0/docker@v0.6.2-0.20161130212042-4addda3f07e7/docs/reference/api/docker_remote_api_v1.19.md (about)

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