github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/docs/api/v1.19.md (about)

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