github.com/endophage/docker@v1.4.2-0.20161027011718-242853499895/docs/reference/api/docker_remote_api_v1.25.md (about)

     1  ---
     2  title: "Remote API v1.25"
     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.25
    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. Errors
    30  
    31  The Remote API uses standard HTTP status codes to indicate the success or failure of the API call. The body of the response will be JSON in the following format:
    32  
    33      {
    34          "message": "page not found"
    35      }
    36  
    37  The status codes that are returned for each endpoint are specified in the endpoint documentation below.
    38  
    39  # 3. Endpoints
    40  
    41  ## 3.1 Containers
    42  
    43  ### List containers
    44  
    45  `GET /containers/json`
    46  
    47  List containers
    48  
    49  **Example request**:
    50  
    51      GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
    52  
    53  **Example response**:
    54  
    55      HTTP/1.1 200 OK
    56      Content-Type: application/json
    57  
    58      [
    59           {
    60                   "Id": "8dfafdbc3a40",
    61                   "Names":["/boring_feynman"],
    62                   "Image": "ubuntu:latest",
    63                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
    64                   "Command": "echo 1",
    65                   "Created": 1367854155,
    66                   "State": "Exited",
    67                   "Status": "Exit 0",
    68                   "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
    69                   "Labels": {
    70                           "com.example.vendor": "Acme",
    71                           "com.example.license": "GPL",
    72                           "com.example.version": "1.0"
    73                   },
    74                   "SizeRw": 12288,
    75                   "SizeRootFs": 0,
    76                   "HostConfig": {
    77                           "NetworkMode": "default"
    78                   },
    79                   "NetworkSettings": {
    80                           "Networks": {
    81                                   "bridge": {
    82                                            "IPAMConfig": null,
    83                                            "Links": null,
    84                                            "Aliases": null,
    85                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
    86                                            "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
    87                                            "Gateway": "172.17.0.1",
    88                                            "IPAddress": "172.17.0.2",
    89                                            "IPPrefixLen": 16,
    90                                            "IPv6Gateway": "",
    91                                            "GlobalIPv6Address": "",
    92                                            "GlobalIPv6PrefixLen": 0,
    93                                            "MacAddress": "02:42:ac:11:00:02"
    94                                    }
    95                           }
    96                   },
    97                   "Mounts": [
    98                           {
    99                                    "Name": "fac362...80535",
   100                                    "Source": "/data",
   101                                    "Destination": "/data",
   102                                    "Driver": "local",
   103                                    "Mode": "ro,Z",
   104                                    "RW": false,
   105                                    "Propagation": ""
   106                           }
   107                   ]
   108           },
   109           {
   110                   "Id": "9cd87474be90",
   111                   "Names":["/coolName"],
   112                   "Image": "ubuntu:latest",
   113                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
   114                   "Command": "echo 222222",
   115                   "Created": 1367854155,
   116                   "State": "Exited",
   117                   "Status": "Exit 0",
   118                   "Ports": [],
   119                   "Labels": {},
   120                   "SizeRw": 12288,
   121                   "SizeRootFs": 0,
   122                   "HostConfig": {
   123                           "NetworkMode": "default"
   124                   },
   125                   "NetworkSettings": {
   126                           "Networks": {
   127                                   "bridge": {
   128                                            "IPAMConfig": null,
   129                                            "Links": null,
   130                                            "Aliases": null,
   131                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   132                                            "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
   133                                            "Gateway": "172.17.0.1",
   134                                            "IPAddress": "172.17.0.8",
   135                                            "IPPrefixLen": 16,
   136                                            "IPv6Gateway": "",
   137                                            "GlobalIPv6Address": "",
   138                                            "GlobalIPv6PrefixLen": 0,
   139                                            "MacAddress": "02:42:ac:11:00:08"
   140                                    }
   141                           }
   142                   },
   143                   "Mounts": []
   144           },
   145           {
   146                   "Id": "3176a2479c92",
   147                   "Names":["/sleepy_dog"],
   148                   "Image": "ubuntu:latest",
   149                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
   150                   "Command": "echo 3333333333333333",
   151                   "Created": 1367854154,
   152                   "State": "Exited",
   153                   "Status": "Exit 0",
   154                   "Ports":[],
   155                   "Labels": {},
   156                   "SizeRw":12288,
   157                   "SizeRootFs":0,
   158                   "HostConfig": {
   159                           "NetworkMode": "default"
   160                   },
   161                   "NetworkSettings": {
   162                           "Networks": {
   163                                   "bridge": {
   164                                            "IPAMConfig": null,
   165                                            "Links": null,
   166                                            "Aliases": null,
   167                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   168                                            "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
   169                                            "Gateway": "172.17.0.1",
   170                                            "IPAddress": "172.17.0.6",
   171                                            "IPPrefixLen": 16,
   172                                            "IPv6Gateway": "",
   173                                            "GlobalIPv6Address": "",
   174                                            "GlobalIPv6PrefixLen": 0,
   175                                            "MacAddress": "02:42:ac:11:00:06"
   176                                    }
   177                           }
   178                   },
   179                   "Mounts": []
   180           },
   181           {
   182                   "Id": "4cb07b47f9fb",
   183                   "Names":["/running_cat"],
   184                   "Image": "ubuntu:latest",
   185                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
   186                   "Command": "echo 444444444444444444444444444444444",
   187                   "Created": 1367854152,
   188                   "State": "Exited",
   189                   "Status": "Exit 0",
   190                   "Ports": [],
   191                   "Labels": {},
   192                   "SizeRw": 12288,
   193                   "SizeRootFs": 0,
   194                   "HostConfig": {
   195                           "NetworkMode": "default"
   196                   },
   197                   "NetworkSettings": {
   198                           "Networks": {
   199                                   "bridge": {
   200                                            "IPAMConfig": null,
   201                                            "Links": null,
   202                                            "Aliases": null,
   203                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   204                                            "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
   205                                            "Gateway": "172.17.0.1",
   206                                            "IPAddress": "172.17.0.5",
   207                                            "IPPrefixLen": 16,
   208                                            "IPv6Gateway": "",
   209                                            "GlobalIPv6Address": "",
   210                                            "GlobalIPv6PrefixLen": 0,
   211                                            "MacAddress": "02:42:ac:11:00:05"
   212                                    }
   213                           }
   214                   },
   215                   "Mounts": []
   216           }
   217      ]
   218  
   219  **Query parameters**:
   220  
   221  -   **all** – 1/True/true or 0/False/false, Show all containers.
   222          Only running containers are shown by default (i.e., this defaults to false)
   223  -   **limit** – Show `limit` last created
   224          containers, include non-running ones.
   225  -   **since** – Show only containers created since Id, include
   226          non-running ones.
   227  -   **before** – Show only containers created before Id, include
   228          non-running ones.
   229  -   **size** – 1/True/true or 0/False/false, Show the containers
   230          sizes
   231  -   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
   232    -   `exited=<int>`; -- containers with exit code of  `<int>` ;
   233    -   `status=`(`created`|`restarting`|`running`|`removing`|`paused`|`exited`|`dead`)
   234    -   `label=key` or `label="key=value"` of a container label
   235    -   `isolation=`(`default`|`process`|`hyperv`)   (Windows daemon only)
   236        `id=<ID>` a container's ID
   237        `name=<name>` a container's name
   238        `is-task=`(`true`|`false`)
   239    -   `ancestor`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
   240    -   `before`=(`<container id>` or `<container name>`)
   241    -   `since`=(`<container id>` or `<container name>`)
   242    -   `volume`=(`<volume name>` or `<mount point destination>`)
   243    -   `network`=(`<network id>` or `<network name>`)
   244  
   245  **Status codes**:
   246  
   247  -   **200** – no error
   248  -   **400** – bad parameter
   249  -   **500** – server error
   250  
   251  ### Create a container
   252  
   253  `POST /containers/create`
   254  
   255  Create a container
   256  
   257  **Example request**:
   258  
   259      POST /containers/create HTTP/1.1
   260      Content-Type: application/json
   261  
   262      {
   263             "Hostname": "",
   264             "Domainname": "",
   265             "User": "",
   266             "AttachStdin": false,
   267             "AttachStdout": true,
   268             "AttachStderr": true,
   269             "Tty": false,
   270             "OpenStdin": false,
   271             "StdinOnce": false,
   272             "Env": [
   273                     "FOO=bar",
   274                     "BAZ=quux"
   275             ],
   276             "Cmd": [
   277                     "date"
   278             ],
   279             "Entrypoint": "",
   280             "Image": "ubuntu",
   281             "Labels": {
   282                     "com.example.vendor": "Acme",
   283                     "com.example.license": "GPL",
   284                     "com.example.version": "1.0"
   285             },
   286             "Volumes": {
   287               "/volumes/data": {}
   288             },
   289             "WorkingDir": "",
   290             "NetworkDisabled": false,
   291             "MacAddress": "12:34:56:78:9a:bc",
   292             "ExposedPorts": {
   293                     "22/tcp": {}
   294             },
   295             "StopSignal": "SIGTERM",
   296             "StopTimeout": 10,
   297             "HostConfig": {
   298               "Binds": ["/tmp:/tmp"],
   299               "Links": ["redis3:redis"],
   300               "Memory": 0,
   301               "MemorySwap": 0,
   302               "MemoryReservation": 0,
   303               "KernelMemory": 0,
   304               "CpuPercent": 80,
   305               "CpuShares": 512,
   306               "CpuPeriod": 100000,
   307               "CpuRealtimePeriod": 1000000,
   308               "CpuRealtimeRuntime": 10000,
   309               "CpuQuota": 50000,
   310               "CpusetCpus": "0,1",
   311               "CpusetMems": "0,1",
   312               "IOMaximumBandwidth": 0,
   313               "IOMaximumIOps": 0,
   314               "BlkioWeight": 300,
   315               "BlkioWeightDevice": [{}],
   316               "BlkioDeviceReadBps": [{}],
   317               "BlkioDeviceReadIOps": [{}],
   318               "BlkioDeviceWriteBps": [{}],
   319               "BlkioDeviceWriteIOps": [{}],
   320               "MemorySwappiness": 60,
   321               "OomKillDisable": false,
   322               "OomScoreAdj": 500,
   323               "PidMode": "",
   324               "PidsLimit": -1,
   325               "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
   326               "PublishAllPorts": false,
   327               "Privileged": false,
   328               "ReadonlyRootfs": false,
   329               "Dns": ["8.8.8.8"],
   330               "DnsOptions": [""],
   331               "DnsSearch": [""],
   332               "ExtraHosts": null,
   333               "VolumesFrom": ["parent", "other:ro"],
   334               "CapAdd": ["NET_ADMIN"],
   335               "CapDrop": ["MKNOD"],
   336               "GroupAdd": ["newgroup"],
   337               "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
   338               "AutoRemove": true,
   339               "NetworkMode": "bridge",
   340               "Devices": [],
   341               "Sysctls": { "net.ipv4.ip_forward": "1" },
   342               "Ulimits": [{}],
   343               "LogConfig": { "Type": "json-file", "Config": {} },
   344               "SecurityOpt": [],
   345               "StorageOpt": {},
   346               "CgroupParent": "",
   347               "VolumeDriver": "",
   348               "ShmSize": 67108864,
   349               "Mounts": []
   350            },
   351            "NetworkingConfig": {
   352                "EndpointsConfig": {
   353                    "isolated_nw" : {
   354                        "IPAMConfig": {
   355                            "IPv4Address":"172.20.30.33",
   356                            "IPv6Address":"2001:db8:abcd::3033",
   357                            "LinkLocalIPs":["169.254.34.68", "fe80::3468"]
   358                        },
   359                        "Links":["container_1", "container_2"],
   360                        "Aliases":["server_x", "server_y"]
   361                    }
   362                }
   363            }
   364        }
   365  
   366  **Example response**:
   367  
   368        HTTP/1.1 201 Created
   369        Content-Type: application/json
   370  
   371        {
   372             "Id":"e90e34656806",
   373             "Warnings":[]
   374        }
   375  
   376  **JSON parameters**:
   377  
   378  -   **Hostname** - A string value containing the hostname to use for the
   379        container. This must be a valid RFC 1123 hostname.
   380  -   **Domainname** - A string value containing the domain name to use
   381        for the container.
   382  -   **User** - A string value specifying the user inside the container.
   383  -   **AttachStdin** - Boolean value, attaches to `stdin`.
   384  -   **AttachStdout** - Boolean value, attaches to `stdout`.
   385  -   **AttachStderr** - Boolean value, attaches to `stderr`.
   386  -   **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
   387  -   **OpenStdin** - Boolean value, opens `stdin`,
   388  -   **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
   389  -   **Env** - A list of environment variables in the form of `["VAR=value", ...]`
   390  -   **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value", ... }`
   391  -   **Cmd** - Command to run specified as a string or an array of strings.
   392  -   **Entrypoint** - Set the entry point for the container as a string or an array
   393        of strings. If the array consists of exactly one empty string (`[""]`) then the entry point
   394        is reset to system default (i.e., the entry point used by docker when there is no `ENTRYPOINT`
   395        instruction in the Dockerfile).
   396  -   **Image** - A string specifying the image name to use for the container.
   397  -   **Volumes** - An object mapping mount point paths (strings) inside the
   398        container to empty objects.
   399  -   **WorkingDir** - A string specifying the working directory for commands to
   400        run in.
   401  -   **NetworkDisabled** - Boolean value, when true disables networking for the
   402        container
   403  -   **ExposedPorts** - An object mapping ports to an empty object in the form of:
   404        `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
   405  -   **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
   406  -   **StopTimeout** - Timeout (in seconds) to stop a container. 10 by default.
   407  -   **HostConfig**
   408      -   **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
   409             + `host-src:container-dest` to bind-mount a host path into the
   410               container. Both `host-src`, and `container-dest` must be an
   411               _absolute_ path.
   412             + `host-src:container-dest:ro` to make the bind-mount read-only
   413               inside the container. Both `host-src`, and `container-dest` must be
   414               an _absolute_ path.
   415             + `volume-name:container-dest` to bind-mount a volume managed by a
   416               volume driver into the container. `container-dest` must be an
   417               _absolute_ path.
   418             + `volume-name:container-dest:ro` to mount the volume read-only
   419               inside the container.  `container-dest` must be an _absolute_ path.
   420      -   **Links** - A list of links for the container. Each link entry should be
   421            in the form of `container_name:alias`.
   422      -   **Memory** - Memory limit in bytes.
   423      -   **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
   424            You must use this with `memory` and make the swap value larger than `memory`.
   425      -   **MemoryReservation** - Memory soft limit in bytes.
   426      -   **KernelMemory** - Kernel memory limit in bytes.
   427      -   **CpuPercent** - An integer value containing the usable percentage of the available CPUs. (Windows daemon only)
   428      -   **CpuShares** - An integer value containing the container's CPU Shares
   429            (ie. the relative weight vs other containers).
   430      -   **CpuPeriod** - The length of a CPU period in microseconds.
   431      -   **CpuRealtimePeriod** - The length of a CPU real-time period in microseconds (0=no time allocated for rt tasks)
   432      -   **CpuRealtimeRuntime** - The length of a CPU real-time runtime in microseconds (0=no time allocated for rt tasks)
   433      -   **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
   434      -   **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
   435      -   **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
   436      -   **IOMaximumBandwidth** - Maximum IO absolute rate in terms of IOps.
   437      -   **IOMaximumIOps** - Maximum IO absolute rate in terms of bytes per second.
   438      -   **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
   439      -   **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of:        `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
   440      -   **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of:	`"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
   441          `"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
   442      -   **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of:	`"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
   443          `"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
   444      -   **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of:	`"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
   445          `"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
   446      -   **BlkioDeviceWiiteIOps** - Limit write rate (IO per second) to a device in the form of:	`"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
   447          `"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
   448      -   **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
   449      -   **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
   450      -   **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
   451      -   **PidMode** - Set the PID (Process) Namespace mode for the container;
   452            `"container:<name|id>"`: joins another container's PID namespace
   453            `"host"`: use the host's PID namespace inside the container
   454      -   **PidsLimit** - Tune a container's pids limit. Set -1 for unlimited.
   455      -   **PortBindings** - A map of exposed container ports and the host port they
   456            should map to. A JSON object in the form
   457            `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
   458            Take note that `port` is specified as a string and not an integer value.
   459      -   **PublishAllPorts** - Allocates a random host port for all of a container's
   460            exposed ports. Specified as a boolean value.
   461      -   **Privileged** - Gives the container full access to the host. Specified as
   462            a boolean value.
   463      -   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
   464            Specified as a boolean value.
   465      -   **Dns** - A list of DNS servers for the container to use.
   466      -   **DnsOptions** - A list of DNS options
   467      -   **DnsSearch** - A list of DNS search domains
   468      -   **ExtraHosts** - A list of hostnames/IP mappings to add to the
   469          container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
   470      -   **VolumesFrom** - A list of volumes to inherit from another container.
   471            Specified in the form `<container name>[:<ro|rw>]`
   472      -   **CapAdd** - A list of kernel capabilities to add to the container.
   473      -   **Capdrop** - A list of kernel capabilities to drop from the container.
   474      -   **GroupAdd** - A list of additional groups that the container process will run as
   475      -   **RestartPolicy** – The behavior to apply when the container exits.  The
   476              value is an object with a `Name` property of either `"always"` to
   477              always restart, `"unless-stopped"` to restart always except when
   478              user has manually stopped the container or `"on-failure"` to restart only when the container
   479              exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
   480              controls the number of times to retry before giving up.
   481              The default is not to restart. (optional)
   482              An ever increasing delay (double the previous delay, starting at 100mS)
   483              is added before each restart to prevent flooding the server.
   484      -   **AutoRemove** - Boolean value, set to `true` to automatically remove the container on daemon side
   485              when the container's process exits. Note that `RestartPolicy` other than `none` is exclusive to `AutoRemove`.
   486      -   **UsernsMode**  - Sets the usernamespace mode for the container when usernamespace remapping option is enabled.
   487             supported values are: `host`.
   488      -   **NetworkMode** - Sets the networking mode for the container. Supported
   489            standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. Any other value is taken
   490            as a custom network's name to which this container should connect to.
   491      -   **Devices** - A list of devices to add to the container specified as a JSON object in the
   492        form
   493            `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
   494      -   **Ulimits** - A list of ulimits to set in the container, specified as
   495            `{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
   496            `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
   497      -   **Sysctls** - A list of kernel parameters (sysctls) to set in the container, specified as
   498            `{ <name>: <Value> }`, for example:
   499  	  `{ "net.ipv4.ip_forward": "1" }`
   500      -   **SecurityOpt**: A list of string values to customize labels for MLS
   501          systems, such as SELinux.
   502      -   **StorageOpt**: Storage driver options per container. Options can be passed in the form
   503          `{"size":"120G"}`
   504      -   **LogConfig** - Log configuration for the container, specified as a JSON object in the form
   505            `{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
   506            Available types: `json-file`, `syslog`, `journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`.
   507            `json-file` logging driver.
   508      -   **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.
   509      -   **VolumeDriver** - Driver that this container users to mount volumes.
   510      -   **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
   511      -   **Mounts** – Specification for mounts to be added to the container.
   512          - **Target** – Container path.
   513          - **Source** – Mount source (e.g. a volume name, a host path).
   514          - **Type** – The mount type (`bind`, or `volume`).
   515            Available types (for the `Type` field):
   516            - **bind** - Mounts a file or directory from the host into the container. Must exist prior to creating the container.
   517            - **volume** - Creates a volume with the given name and options (or uses a pre-existing volume with the same name and options). These are **not** removed when the container is removed.
   518          - **ReadOnly** – A boolean indicating whether the mount should be read-only.
   519          - **BindOptions** - Optional configuration for the `bind` type.
   520            - **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
   521          - **VolumeOptions** – Optional configuration for the `volume` type.
   522              - **NoCopy** – A boolean indicating if volume should be
   523                populated with the data from the target. (Default false)
   524              - **Labels** – User-defined name and labels for the volume as key/value pairs: `{"name": "value"}`
   525              - **DriverConfig** – Map of driver-specific options.
   526                - **Name** - Name of the driver to use to create the volume.
   527                - **Options** - key/value map of driver specific options.
   528  
   529  
   530  **Query parameters**:
   531  
   532  -   **name** – Assign the specified name to the container. Must
   533      match `/?[a-zA-Z0-9_-]+`.
   534  
   535  **Status codes**:
   536  
   537  -   **201** – no error
   538  -   **400** – bad parameter
   539  -   **404** – no such container
   540  -   **406** – impossible to attach (container not running)
   541  -   **409** – conflict
   542  -   **500** – server error
   543  
   544  ### Inspect a container
   545  
   546  `GET /containers/(id or name)/json`
   547  
   548  Return low-level information on the container `id`
   549  
   550  **Example request**:
   551  
   552        GET /containers/4fa6e0f0c678/json HTTP/1.1
   553  
   554  **Example response**:
   555  
   556      HTTP/1.1 200 OK
   557      Content-Type: application/json
   558  
   559  	{
   560  		"AppArmorProfile": "",
   561  		"Args": [
   562  			"-c",
   563  			"exit 9"
   564  		],
   565  		"Config": {
   566  			"AttachStderr": true,
   567  			"AttachStdin": false,
   568  			"AttachStdout": true,
   569  			"Cmd": [
   570  				"/bin/sh",
   571  				"-c",
   572  				"exit 9"
   573  			],
   574  			"Domainname": "",
   575  			"Entrypoint": null,
   576  			"Env": [
   577  				"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   578  			],
   579  			"ExposedPorts": null,
   580  			"Hostname": "ba033ac44011",
   581  			"Image": "ubuntu",
   582  			"Labels": {
   583  				"com.example.vendor": "Acme",
   584  				"com.example.license": "GPL",
   585  				"com.example.version": "1.0"
   586  			},
   587  			"MacAddress": "",
   588  			"NetworkDisabled": false,
   589  			"OnBuild": null,
   590  			"OpenStdin": false,
   591  			"StdinOnce": false,
   592  			"Tty": false,
   593  			"User": "",
   594  			"Volumes": {
   595  				"/volumes/data": {}
   596  			},
   597  			"WorkingDir": "",
   598  			"StopSignal": "SIGTERM",
   599  			"StopTimeout": 10
   600  		},
   601  		"Created": "2015-01-06T15:47:31.485331387Z",
   602  		"Driver": "devicemapper",
   603  		"ExecIDs": null,
   604  		"HostConfig": {
   605  			"Binds": null,
   606  			"IOMaximumBandwidth": 0,
   607  			"IOMaximumIOps": 0,
   608  			"BlkioWeight": 0,
   609  			"BlkioWeightDevice": [{}],
   610  			"BlkioDeviceReadBps": [{}],
   611  			"BlkioDeviceWriteBps": [{}],
   612  			"BlkioDeviceReadIOps": [{}],
   613  			"BlkioDeviceWriteIOps": [{}],
   614  			"CapAdd": null,
   615  			"CapDrop": null,
   616  			"ContainerIDFile": "",
   617  			"CpusetCpus": "",
   618  			"CpusetMems": "",
   619  			"CpuPercent": 80,
   620  			"CpuShares": 0,
   621  			"CpuPeriod": 100000,
   622  			"CpuRealtimePeriod": 1000000,
   623  			"CpuRealtimeRuntime": 10000,
   624  			"Devices": [],
   625  			"Dns": null,
   626  			"DnsOptions": null,
   627  			"DnsSearch": null,
   628  			"ExtraHosts": null,
   629  			"IpcMode": "",
   630  			"Links": null,
   631  			"LxcConf": [],
   632  			"Memory": 0,
   633  			"MemorySwap": 0,
   634  			"MemoryReservation": 0,
   635  			"KernelMemory": 0,
   636  			"OomKillDisable": false,
   637  			"OomScoreAdj": 500,
   638  			"NetworkMode": "bridge",
   639  			"PidMode": "",
   640  			"PortBindings": {},
   641  			"Privileged": false,
   642  			"ReadonlyRootfs": false,
   643  			"PublishAllPorts": false,
   644  			"RestartPolicy": {
   645  				"MaximumRetryCount": 2,
   646  				"Name": "on-failure"
   647  			},
   648  			"AutoRemove": true,
   649  			"LogConfig": {
   650  				"Config": null,
   651  				"Type": "json-file"
   652  			},
   653  			"SecurityOpt": null,
   654  			"Sysctls": {
   655  			        "net.ipv4.ip_forward": "1"
   656  			},
   657  			"StorageOpt": null,
   658  			"VolumesFrom": null,
   659  			"Ulimits": [{}],
   660  			"VolumeDriver": "",
   661  			"ShmSize": 67108864,
   662  			"Mounts": []
   663  		},
   664  		"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
   665  		"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
   666  		"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
   667  		"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
   668  		"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
   669  		"MountLabel": "",
   670  		"Name": "/boring_euclid",
   671  		"NetworkSettings": {
   672  			"Bridge": "",
   673  			"SandboxID": "",
   674  			"HairpinMode": false,
   675  			"LinkLocalIPv6Address": "",
   676  			"LinkLocalIPv6PrefixLen": 0,
   677  			"Ports": null,
   678  			"SandboxKey": "",
   679  			"SecondaryIPAddresses": null,
   680  			"SecondaryIPv6Addresses": null,
   681  			"EndpointID": "",
   682  			"Gateway": "",
   683  			"GlobalIPv6Address": "",
   684  			"GlobalIPv6PrefixLen": 0,
   685  			"IPAddress": "",
   686  			"IPPrefixLen": 0,
   687  			"IPv6Gateway": "",
   688  			"MacAddress": "",
   689  			"Networks": {
   690  				"bridge": {
   691  					"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   692  					"EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
   693  					"Gateway": "172.17.0.1",
   694  					"IPAddress": "172.17.0.2",
   695  					"IPPrefixLen": 16,
   696  					"IPv6Gateway": "",
   697  					"GlobalIPv6Address": "",
   698  					"GlobalIPv6PrefixLen": 0,
   699  					"MacAddress": "02:42:ac:12:00:02"
   700  				}
   701  			}
   702  		},
   703  		"Path": "/bin/sh",
   704  		"ProcessLabel": "",
   705  		"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
   706  		"RestartCount": 1,
   707  		"State": {
   708  			"Error": "",
   709  			"ExitCode": 9,
   710  			"FinishedAt": "2015-01-06T15:47:32.080254511Z",
   711  			"OOMKilled": false,
   712  			"Dead": false,
   713  			"Paused": false,
   714  			"Pid": 0,
   715  			"Restarting": false,
   716  			"Running": true,
   717  			"StartedAt": "2015-01-06T15:47:32.072697474Z",
   718  			"Status": "running"
   719  		},
   720  		"Mounts": [
   721  			{
   722  				"Name": "fac362...80535",
   723  				"Source": "/data",
   724  				"Destination": "/data",
   725  				"Driver": "local",
   726  				"Mode": "ro,Z",
   727  				"RW": false,
   728  				"Propagation": ""
   729  			}
   730  		]
   731  	}
   732  
   733  **Example request, with size information**:
   734  
   735      GET /containers/4fa6e0f0c678/json?size=1 HTTP/1.1
   736  
   737  **Example response, with size information**:
   738  
   739      HTTP/1.1 200 OK
   740      Content-Type: application/json
   741  
   742      {
   743      ....
   744      "SizeRw": 0,
   745      "SizeRootFs": 972,
   746      ....
   747      }
   748  
   749  **Query parameters**:
   750  
   751  -   **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
   752  
   753  **Status codes**:
   754  
   755  -   **200** – no error
   756  -   **404** – no such container
   757  -   **500** – server error
   758  
   759  ### List processes running inside a container
   760  
   761  `GET /containers/(id or name)/top`
   762  
   763  List processes running inside the container `id`. On Unix systems this
   764  is done by running the `ps` command. This endpoint is not
   765  supported on Windows.
   766  
   767  **Example request**:
   768  
   769      GET /containers/4fa6e0f0c678/top HTTP/1.1
   770  
   771  **Example response**:
   772  
   773      HTTP/1.1 200 OK
   774      Content-Type: application/json
   775  
   776      {
   777         "Titles" : [
   778           "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
   779         ],
   780         "Processes" : [
   781           [
   782             "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
   783           ],
   784           [
   785             "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
   786           ]
   787         ]
   788      }
   789  
   790  **Example request**:
   791  
   792      GET /containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
   793  
   794  **Example response**:
   795  
   796      HTTP/1.1 200 OK
   797      Content-Type: application/json
   798  
   799      {
   800        "Titles" : [
   801          "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
   802        ]
   803        "Processes" : [
   804          [
   805            "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
   806          ],
   807          [
   808            "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
   809          ]
   810        ],
   811      }
   812  
   813  **Query parameters**:
   814  
   815  -   **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
   816  
   817  **Status codes**:
   818  
   819  -   **200** – no error
   820  -   **404** – no such container
   821  -   **500** – server error
   822  
   823  ### Get container logs
   824  
   825  `GET /containers/(id or name)/logs`
   826  
   827  Get `stdout` and `stderr` logs from the container ``id``
   828  
   829  > **Note**:
   830  > This endpoint works only for containers with the `json-file` or `journald` logging drivers.
   831  
   832  **Example request**:
   833  
   834       GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
   835  
   836  **Example response**:
   837  
   838       HTTP/1.1 101 UPGRADED
   839       Content-Type: application/vnd.docker.raw-stream
   840       Connection: Upgrade
   841       Upgrade: tcp
   842  
   843       {% raw %}
   844       {{ STREAM }}
   845       {% endraw %}
   846  
   847  **Query parameters**:
   848  
   849  -   **details** - 1/True/true or 0/False/flase, Show extra details provided to logs. Default `false`.
   850  -   **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
   851  -   **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
   852  -   **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
   853  -   **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
   854      will only output log-entries since that timestamp. Default: 0 (unfiltered)
   855  -   **timestamps** – 1/True/true or 0/False/false, print timestamps for
   856          every log line. Default `false`.
   857  -   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
   858  
   859  **Status codes**:
   860  
   861  -   **101** – no error, hints proxy about hijacking
   862  -   **200** – no error, no upgrade header found
   863  -   **404** – no such container
   864  -   **500** – server error
   865  
   866  ### Inspect changes on a container's filesystem
   867  
   868  `GET /containers/(id or name)/changes`
   869  
   870  Inspect changes on container `id`'s filesystem
   871  
   872  **Example request**:
   873  
   874      GET /containers/4fa6e0f0c678/changes HTTP/1.1
   875  
   876  **Example response**:
   877  
   878      HTTP/1.1 200 OK
   879      Content-Type: application/json
   880  
   881      [
   882           {
   883                   "Path": "/dev",
   884                   "Kind": 0
   885           },
   886           {
   887                   "Path": "/dev/kmsg",
   888                   "Kind": 1
   889           },
   890           {
   891                   "Path": "/test",
   892                   "Kind": 1
   893           }
   894      ]
   895  
   896  Values for `Kind`:
   897  
   898  - `0`: Modify
   899  - `1`: Add
   900  - `2`: Delete
   901  
   902  **Status codes**:
   903  
   904  -   **200** – no error
   905  -   **404** – no such container
   906  -   **500** – server error
   907  
   908  ### Export a container
   909  
   910  `GET /containers/(id or name)/export`
   911  
   912  Export the contents of container `id`
   913  
   914  **Example request**:
   915  
   916      GET /containers/4fa6e0f0c678/export HTTP/1.1
   917  
   918  **Example response**:
   919  
   920      HTTP/1.1 200 OK
   921      Content-Type: application/octet-stream
   922  
   923      {% raw %}
   924      {{ TAR STREAM }}
   925      {% endraw %}
   926  
   927  **Status codes**:
   928  
   929  -   **200** – no error
   930  -   **404** – no such container
   931  -   **500** – server error
   932  
   933  ### Get container stats based on resource usage
   934  
   935  `GET /containers/(id or name)/stats`
   936  
   937  This endpoint returns a live stream of a container's resource usage statistics.
   938  
   939  **Example request**:
   940  
   941      GET /containers/redis1/stats HTTP/1.1
   942  
   943  **Example response**:
   944  
   945        HTTP/1.1 200 OK
   946        Content-Type: application/json
   947  
   948        {
   949           "read" : "2015-01-08T22:57:31.547920715Z",
   950           "pids_stats": {
   951              "current": 3
   952           },
   953           "networks": {
   954                   "eth0": {
   955                       "rx_bytes": 5338,
   956                       "rx_dropped": 0,
   957                       "rx_errors": 0,
   958                       "rx_packets": 36,
   959                       "tx_bytes": 648,
   960                       "tx_dropped": 0,
   961                       "tx_errors": 0,
   962                       "tx_packets": 8
   963                   },
   964                   "eth5": {
   965                       "rx_bytes": 4641,
   966                       "rx_dropped": 0,
   967                       "rx_errors": 0,
   968                       "rx_packets": 26,
   969                       "tx_bytes": 690,
   970                       "tx_dropped": 0,
   971                       "tx_errors": 0,
   972                       "tx_packets": 9
   973                   }
   974           },
   975           "memory_stats" : {
   976              "stats" : {
   977                 "total_pgmajfault" : 0,
   978                 "cache" : 0,
   979                 "mapped_file" : 0,
   980                 "total_inactive_file" : 0,
   981                 "pgpgout" : 414,
   982                 "rss" : 6537216,
   983                 "total_mapped_file" : 0,
   984                 "writeback" : 0,
   985                 "unevictable" : 0,
   986                 "pgpgin" : 477,
   987                 "total_unevictable" : 0,
   988                 "pgmajfault" : 0,
   989                 "total_rss" : 6537216,
   990                 "total_rss_huge" : 6291456,
   991                 "total_writeback" : 0,
   992                 "total_inactive_anon" : 0,
   993                 "rss_huge" : 6291456,
   994                 "hierarchical_memory_limit" : 67108864,
   995                 "total_pgfault" : 964,
   996                 "total_active_file" : 0,
   997                 "active_anon" : 6537216,
   998                 "total_active_anon" : 6537216,
   999                 "total_pgpgout" : 414,
  1000                 "total_cache" : 0,
  1001                 "inactive_anon" : 0,
  1002                 "active_file" : 0,
  1003                 "pgfault" : 964,
  1004                 "inactive_file" : 0,
  1005                 "total_pgpgin" : 477
  1006              },
  1007              "max_usage" : 6651904,
  1008              "usage" : 6537216,
  1009              "failcnt" : 0,
  1010              "limit" : 67108864
  1011           },
  1012           "blkio_stats" : {},
  1013           "cpu_stats" : {
  1014              "cpu_usage" : {
  1015                 "percpu_usage" : [
  1016                    8646879,
  1017                    24472255,
  1018                    36438778,
  1019                    30657443
  1020                 ],
  1021                 "usage_in_usermode" : 50000000,
  1022                 "total_usage" : 100215355,
  1023                 "usage_in_kernelmode" : 30000000
  1024              },
  1025              "system_cpu_usage" : 739306590000000,
  1026              "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
  1027           },
  1028           "precpu_stats" : {
  1029              "cpu_usage" : {
  1030                 "percpu_usage" : [
  1031                    8646879,
  1032                    24350896,
  1033                    36438778,
  1034                    30657443
  1035                 ],
  1036                 "usage_in_usermode" : 50000000,
  1037                 "total_usage" : 100093996,
  1038                 "usage_in_kernelmode" : 30000000
  1039              },
  1040              "system_cpu_usage" : 9492140000000,
  1041              "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
  1042           }
  1043        }
  1044  
  1045  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.
  1046  
  1047  **Query parameters**:
  1048  
  1049  -   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
  1050  
  1051  **Status codes**:
  1052  
  1053  -   **200** – no error
  1054  -   **404** – no such container
  1055  -   **500** – server error
  1056  
  1057  ### Resize a container TTY
  1058  
  1059  `POST /containers/(id or name)/resize`
  1060  
  1061  Resize the TTY for container with  `id`. The unit is number of characters. You must restart the container for the resize to take effect.
  1062  
  1063  **Example request**:
  1064  
  1065        POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
  1066  
  1067  **Example response**:
  1068  
  1069        HTTP/1.1 200 OK
  1070        Content-Length: 0
  1071        Content-Type: text/plain; charset=utf-8
  1072  
  1073  **Query parameters**:
  1074  
  1075  -   **h** – height of `tty` session
  1076  -   **w** – width
  1077  
  1078  **Status codes**:
  1079  
  1080  -   **200** – no error
  1081  -   **404** – No such container
  1082  -   **500** – Cannot resize container
  1083  
  1084  ### Start a container
  1085  
  1086  `POST /containers/(id or name)/start`
  1087  
  1088  Start the container `id`
  1089  
  1090  **Example request**:
  1091  
  1092      POST /containers/e90e34656806/start HTTP/1.1
  1093  
  1094  **Example response**:
  1095  
  1096      HTTP/1.1 204 No Content
  1097  
  1098  **Query parameters**:
  1099  
  1100  -   **detachKeys** – Override the key sequence for detaching a
  1101          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  1102          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  1103  
  1104  **Status codes**:
  1105  
  1106  -   **204** – no error
  1107  -   **304** – container already started
  1108  -   **404** – no such container
  1109  -   **500** – server error
  1110  
  1111  ### Stop a container
  1112  
  1113  `POST /containers/(id or name)/stop`
  1114  
  1115  Stop the container `id`
  1116  
  1117  **Example request**:
  1118  
  1119      POST /containers/e90e34656806/stop?t=5 HTTP/1.1
  1120  
  1121  **Example response**:
  1122  
  1123      HTTP/1.1 204 No Content
  1124  
  1125  **Query parameters**:
  1126  
  1127  -   **t** – number of seconds to wait before killing the container
  1128  
  1129  **Status codes**:
  1130  
  1131  -   **204** – no error
  1132  -   **304** – container already stopped
  1133  -   **404** – no such container
  1134  -   **500** – server error
  1135  
  1136  ### Restart a container
  1137  
  1138  `POST /containers/(id or name)/restart`
  1139  
  1140  Restart the container `id`
  1141  
  1142  **Example request**:
  1143  
  1144      POST /containers/e90e34656806/restart?t=5 HTTP/1.1
  1145  
  1146  **Example response**:
  1147  
  1148      HTTP/1.1 204 No Content
  1149  
  1150  **Query parameters**:
  1151  
  1152  -   **t** – number of seconds to wait before killing the container
  1153  
  1154  **Status codes**:
  1155  
  1156  -   **204** – no error
  1157  -   **404** – no such container
  1158  -   **500** – server error
  1159  
  1160  ### Kill a container
  1161  
  1162  `POST /containers/(id or name)/kill`
  1163  
  1164  Kill the container `id`
  1165  
  1166  **Example request**:
  1167  
  1168      POST /containers/e90e34656806/kill HTTP/1.1
  1169  
  1170  **Example response**:
  1171  
  1172      HTTP/1.1 204 No Content
  1173  
  1174  **Query parameters**:
  1175  
  1176  -   **signal** - Signal to send to the container: integer or string like `SIGINT`.
  1177          When not set, `SIGKILL` is assumed and the call waits for the container to exit.
  1178  
  1179  **Status codes**:
  1180  
  1181  -   **204** – no error
  1182  -   **404** – no such container
  1183  -   **500** – server error
  1184  
  1185  ### Update a container
  1186  
  1187  `POST /containers/(id or name)/update`
  1188  
  1189  Update configuration of one or more containers.
  1190  
  1191  **Example request**:
  1192  
  1193         POST /containers/e90e34656806/update HTTP/1.1
  1194         Content-Type: application/json
  1195  
  1196         {
  1197           "BlkioWeight": 300,
  1198           "CpuShares": 512,
  1199           "CpuPeriod": 100000,
  1200           "CpuRealtimePeriod": 1000000,
  1201           "CpuRealtimeRuntime": 10000,
  1202           "CpuQuota": 50000,
  1203           "CpusetCpus": "0,1",
  1204           "CpusetMems": "0",
  1205           "Memory": 314572800,
  1206           "MemorySwap": 514288000,
  1207           "MemoryReservation": 209715200,
  1208           "KernelMemory": 52428800,
  1209           "RestartPolicy": {
  1210             "MaximumRetryCount": 4,
  1211             "Name": "on-failure"
  1212           },
  1213         }
  1214  
  1215  **Example response**:
  1216  
  1217         HTTP/1.1 200 OK
  1218         Content-Type: application/json
  1219  
  1220         {
  1221             "Warnings": []
  1222         }
  1223  
  1224  **Status codes**:
  1225  
  1226  -   **200** – no error
  1227  -   **400** – bad parameter
  1228  -   **404** – no such container
  1229  -   **500** – server error
  1230  
  1231  ### Rename a container
  1232  
  1233  `POST /containers/(id or name)/rename`
  1234  
  1235  Rename the container `id` to a `new_name`
  1236  
  1237  **Example request**:
  1238  
  1239      POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
  1240  
  1241  **Example response**:
  1242  
  1243      HTTP/1.1 204 No Content
  1244  
  1245  **Query parameters**:
  1246  
  1247  -   **name** – new name for the container
  1248  
  1249  **Status codes**:
  1250  
  1251  -   **204** – no error
  1252  -   **404** – no such container
  1253  -   **409** - conflict name already assigned
  1254  -   **500** – server error
  1255  
  1256  ### Pause a container
  1257  
  1258  `POST /containers/(id or name)/pause`
  1259  
  1260  Pause the container `id`
  1261  
  1262  **Example request**:
  1263  
  1264      POST /containers/e90e34656806/pause HTTP/1.1
  1265  
  1266  **Example response**:
  1267  
  1268      HTTP/1.1 204 No Content
  1269  
  1270  **Status codes**:
  1271  
  1272  -   **204** – no error
  1273  -   **404** – no such container
  1274  -   **500** – server error
  1275  
  1276  ### Unpause a container
  1277  
  1278  `POST /containers/(id or name)/unpause`
  1279  
  1280  Unpause the container `id`
  1281  
  1282  **Example request**:
  1283  
  1284      POST /containers/e90e34656806/unpause HTTP/1.1
  1285  
  1286  **Example response**:
  1287  
  1288      HTTP/1.1 204 No Content
  1289  
  1290  **Status codes**:
  1291  
  1292  -   **204** – no error
  1293  -   **404** – no such container
  1294  -   **500** – server error
  1295  
  1296  ### Attach to a container
  1297  
  1298  `POST /containers/(id or name)/attach`
  1299  
  1300  Attach to the container `id`
  1301  
  1302  **Example request**:
  1303  
  1304      POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
  1305  
  1306  **Example response**:
  1307  
  1308      HTTP/1.1 101 UPGRADED
  1309      Content-Type: application/vnd.docker.raw-stream
  1310      Connection: Upgrade
  1311      Upgrade: tcp
  1312  
  1313      {% raw %}
  1314      {{ STREAM }}
  1315      {% endraw %}
  1316  
  1317  **Query parameters**:
  1318  
  1319  -   **detachKeys** – Override the key sequence for detaching a
  1320          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  1321          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  1322  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
  1323  -   **stream** – 1/True/true or 0/False/false, return stream.
  1324          Default `false`.
  1325  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1326          to `stdin`. Default `false`.
  1327  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1328          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1329  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1330          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1331  
  1332  **Status codes**:
  1333  
  1334  -   **101** – no error, hints proxy about hijacking
  1335  -   **200** – no error, no upgrade header found
  1336  -   **400** – bad parameter
  1337  -   **404** – no such container
  1338  -   **409** - container is paused
  1339  -   **500** – server error
  1340  
  1341  **Stream details**:
  1342  
  1343  When using the TTY setting is enabled in
  1344  [`POST /containers/create`
  1345  ](#create-a-container),
  1346  the stream is the raw data from the process PTY and client's `stdin`.
  1347  When the TTY is disabled, then the stream is multiplexed to separate
  1348  `stdout` and `stderr`.
  1349  
  1350  The format is a **Header** and a **Payload** (frame).
  1351  
  1352  **HEADER**
  1353  
  1354  The header contains the information which the stream writes (`stdout` or
  1355  `stderr`). It also contains the size of the associated frame encoded in the
  1356  last four bytes (`uint32`).
  1357  
  1358  It is encoded on the first eight bytes like this:
  1359  
  1360      header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
  1361  
  1362  `STREAM_TYPE` can be:
  1363  
  1364  -   0: `stdin` (is written on `stdout`)
  1365  -   1: `stdout`
  1366  -   2: `stderr`
  1367  
  1368  `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
  1369  the `uint32` size encoded as big endian.
  1370  
  1371  **PAYLOAD**
  1372  
  1373  The payload is the raw stream.
  1374  
  1375  **IMPLEMENTATION**
  1376  
  1377  The simplest way to implement the Attach protocol is the following:
  1378  
  1379      1.  Read eight bytes.
  1380      2.  Choose `stdout` or `stderr` depending on the first byte.
  1381      3.  Extract the frame size from the last four bytes.
  1382      4.  Read the extracted size and output it on the correct output.
  1383      5.  Goto 1.
  1384  
  1385  ### Attach to a container (websocket)
  1386  
  1387  `GET /containers/(id or name)/attach/ws`
  1388  
  1389  Attach to the container `id` via websocket
  1390  
  1391  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
  1392  
  1393  **Example request**
  1394  
  1395      GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
  1396  
  1397  **Example response**
  1398  
  1399      {% raw %}
  1400      {{ STREAM }}
  1401      {% endraw %}
  1402  
  1403  **Query parameters**:
  1404  
  1405  -   **detachKeys** – Override the key sequence for detaching a
  1406          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  1407          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  1408  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
  1409  -   **stream** – 1/True/true or 0/False/false, return stream.
  1410          Default `false`.
  1411  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1412          to `stdin`. Default `false`.
  1413  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1414          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1415  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1416          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1417  
  1418  **Status codes**:
  1419  
  1420  -   **200** – no error
  1421  -   **400** – bad parameter
  1422  -   **404** – no such container
  1423  -   **500** – server error
  1424  
  1425  ### Wait a container
  1426  
  1427  `POST /containers/(id or name)/wait`
  1428  
  1429  Block until container `id` stops, then returns the exit code
  1430  
  1431  **Example request**:
  1432  
  1433      POST /containers/16253994b7c4/wait HTTP/1.1
  1434  
  1435  **Example response**:
  1436  
  1437      HTTP/1.1 200 OK
  1438      Content-Type: application/json
  1439  
  1440      {"StatusCode": 0}
  1441  
  1442  **Status codes**:
  1443  
  1444  -   **200** – no error
  1445  -   **404** – no such container
  1446  -   **500** – server error
  1447  
  1448  ### Remove a container
  1449  
  1450  `DELETE /containers/(id or name)`
  1451  
  1452  Remove the container `id` from the filesystem
  1453  
  1454  **Example request**:
  1455  
  1456      DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  1457  
  1458  **Example response**:
  1459  
  1460      HTTP/1.1 204 No Content
  1461  
  1462  **Query parameters**:
  1463  
  1464  -   **v** – 1/True/true or 0/False/false, Remove the volumes
  1465          associated to the container. Default `false`.
  1466  -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
  1467          Default `false`.
  1468  
  1469  **Status codes**:
  1470  
  1471  -   **204** – no error
  1472  -   **400** – bad parameter
  1473  -   **404** – no such container
  1474  -   **409** – conflict
  1475  -   **500** – server error
  1476  
  1477  ### Retrieving information about files and folders in a container
  1478  
  1479  `HEAD /containers/(id or name)/archive`
  1480  
  1481  See the description of the `X-Docker-Container-Path-Stat` header in the
  1482  following section.
  1483  
  1484  ### Get an archive of a filesystem resource in a container
  1485  
  1486  `GET /containers/(id or name)/archive`
  1487  
  1488  Get a tar archive of a resource in the filesystem of container `id`.
  1489  
  1490  **Query parameters**:
  1491  
  1492  - **path** - resource in the container's filesystem to archive. Required.
  1493  
  1494      If not an absolute path, it is relative to the container's root directory.
  1495      The resource specified by **path** must exist. To assert that the resource
  1496      is expected to be a directory, **path** should end in `/` or  `/.`
  1497      (assuming a path separator of `/`). If **path** ends in `/.` then this
  1498      indicates that only the contents of the **path** directory should be
  1499      copied. A symlink is always resolved to its target.
  1500  
  1501      > **Note**: It is not possible to copy certain system files such as resources
  1502      > under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
  1503      > container.
  1504  
  1505  **Example request**:
  1506  
  1507      GET /containers/8cce319429b2/archive?path=/root HTTP/1.1
  1508  
  1509  **Example response**:
  1510  
  1511      HTTP/1.1 200 OK
  1512      Content-Type: application/x-tar
  1513      X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
  1514  
  1515      {% raw %}
  1516      {{ TAR STREAM }}
  1517      {% endraw %}
  1518  
  1519  On success, a response header `X-Docker-Container-Path-Stat` will be set to a
  1520  base64-encoded JSON object containing some filesystem header information about
  1521  the archived resource. The above example value would decode to the following
  1522  JSON object (whitespace added for readability):
  1523  
  1524  ```json
  1525  {
  1526      "name": "root",
  1527      "size": 4096,
  1528      "mode": 2147484096,
  1529      "mtime": "2014-02-27T20:51:23Z",
  1530      "linkTarget": ""
  1531  }
  1532  ```
  1533  
  1534  A `HEAD` request can also be made to this endpoint if only this information is
  1535  desired.
  1536  
  1537  **Status codes**:
  1538  
  1539  - **200** - success, returns archive of copied resource
  1540  - **400** - client error, bad parameter, details in JSON response body, one of:
  1541      - must specify path parameter (**path** cannot be empty)
  1542      - not a directory (**path** was asserted to be a directory but exists as a
  1543        file)
  1544  - **404** - client error, resource not found, one of:
  1545      – no such container (container `id` does not exist)
  1546      - no such file or directory (**path** does not exist)
  1547  - **500** - server error
  1548  
  1549  ### Extract an archive of files or folders to a directory in a container
  1550  
  1551  `PUT /containers/(id or name)/archive`
  1552  
  1553  Upload a tar archive to be extracted to a path in the filesystem of container
  1554  `id`.
  1555  
  1556  **Query parameters**:
  1557  
  1558  - **path** - path to a directory in the container
  1559      to extract the archive's contents into. Required.
  1560  
  1561      If not an absolute path, it is relative to the container's root directory.
  1562      The **path** resource must exist.
  1563  - **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
  1564      if unpacking the given content would cause an existing directory to be
  1565      replaced with a non-directory and vice versa.
  1566  
  1567  **Example request**:
  1568  
  1569      PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
  1570      Content-Type: application/x-tar
  1571  
  1572      {% raw %}
  1573      {{ TAR STREAM }}
  1574      {% endraw %}
  1575  
  1576  **Example response**:
  1577  
  1578      HTTP/1.1 200 OK
  1579  
  1580  **Status codes**:
  1581  
  1582  - **200** – the content was extracted successfully
  1583  - **400** - client error, bad parameter, details in JSON response body, one of:
  1584      - must specify path parameter (**path** cannot be empty)
  1585      - not a directory (**path** should be a directory but exists as a file)
  1586      - unable to overwrite existing directory with non-directory
  1587        (if **noOverwriteDirNonDir**)
  1588      - unable to overwrite existing non-directory with directory
  1589        (if **noOverwriteDirNonDir**)
  1590  - **403** - client error, permission denied, the volume
  1591      or container rootfs is marked as read-only.
  1592  - **404** - client error, resource not found, one of:
  1593      – no such container (container `id` does not exist)
  1594      - no such file or directory (**path** resource does not exist)
  1595  - **500** – server error
  1596  
  1597  
  1598  ### Prune stopped containers
  1599  
  1600  `POST /containers/prune`
  1601  
  1602  Delete stopped containers
  1603  
  1604  **Example request**:
  1605  
  1606      POST /containers/prune HTTP/1.1
  1607      Content-Type: application/json
  1608  
  1609      {
  1610      }
  1611  
  1612  **Example response**:
  1613  
  1614      HTTP/1.1 200 OK
  1615      Content-Type: application/json
  1616  
  1617      {
  1618          "ContainersDeleted": [
  1619              "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148"
  1620          ],
  1621          "SpaceReclaimed": 109
  1622      }
  1623  
  1624  **Status codes**:
  1625  
  1626  -   **200** – no error
  1627  -   **500** – server error
  1628  
  1629  ## 3.2 Images
  1630  
  1631  ### List Images
  1632  
  1633  `GET /images/json`
  1634  
  1635  **Example request**:
  1636  
  1637      GET /images/json?all=0 HTTP/1.1
  1638  
  1639  **Example response**:
  1640  
  1641      HTTP/1.1 200 OK
  1642      Content-Type: application/json
  1643  
  1644      [
  1645        {
  1646           "RepoTags": [
  1647             "ubuntu:12.04",
  1648             "ubuntu:precise",
  1649             "ubuntu:latest"
  1650           ],
  1651           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
  1652           "Created": 1365714795,
  1653           "Size": 131506275,
  1654           "VirtualSize": 131506275,
  1655           "Labels": {}
  1656        },
  1657        {
  1658           "RepoTags": [
  1659             "ubuntu:12.10",
  1660             "ubuntu:quantal"
  1661           ],
  1662           "ParentId": "27cf784147099545",
  1663           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1664           "Created": 1364102658,
  1665           "Size": 24653,
  1666           "VirtualSize": 180116135,
  1667           "Labels": {
  1668              "com.example.version": "v1"
  1669           }
  1670        }
  1671      ]
  1672  
  1673  **Example request, with digest information**:
  1674  
  1675      GET /images/json?digests=1 HTTP/1.1
  1676  
  1677  **Example response, with digest information**:
  1678  
  1679      HTTP/1.1 200 OK
  1680      Content-Type: application/json
  1681  
  1682      [
  1683        {
  1684          "Created": 1420064636,
  1685          "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
  1686          "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
  1687          "RepoDigests": [
  1688            "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1689          ],
  1690          "RepoTags": [
  1691            "localhost:5000/test/busybox:latest",
  1692            "playdate:latest"
  1693          ],
  1694          "Size": 0,
  1695          "VirtualSize": 2429728,
  1696          "Labels": {}
  1697        }
  1698      ]
  1699  
  1700  The response shows a single image `Id` associated with two repositories
  1701  (`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
  1702  either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
  1703  `playdate:latest` to reference the image.
  1704  
  1705  You can also use `RepoDigests` values to reference an image. In this response,
  1706  the array has only one reference and that is to the
  1707  `localhost:5000/test/busybox` repository; the `playdate` repository has no
  1708  digest. You can reference this digest using the value:
  1709  `localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
  1710  
  1711  See the `docker run` and `docker build` commands for examples of digest and tag
  1712  references on the command line.
  1713  
  1714  **Query parameters**:
  1715  
  1716  -   **all** – 1/True/true or 0/False/false, default false
  1717  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  1718    -   `dangling=true`
  1719    -   `label=key` or `label="key=value"` of an image label
  1720    -   `before`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
  1721    -   `since`=(`<image-name>[:<tag>]`,  `<image id>` or `<image@digest>`)
  1722  -   **filter** - only return images with the specified name
  1723  
  1724  ### Build image from a Dockerfile
  1725  
  1726  `POST /build`
  1727  
  1728  Build an image from a Dockerfile
  1729  
  1730  **Example request**:
  1731  
  1732      POST /build HTTP/1.1
  1733  
  1734      {% raw %}
  1735      {{ TAR STREAM }}
  1736      {% endraw %}
  1737  
  1738  **Example response**:
  1739  
  1740      HTTP/1.1 200 OK
  1741      Content-Type: application/json
  1742  
  1743      {"stream": "Step 1..."}
  1744      {"stream": "..."}
  1745      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1746  
  1747  The input stream must be a `tar` archive compressed with one of the
  1748  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1749  
  1750  The archive must include a build instructions file, typically called
  1751  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1752  used to specify a different build instructions file. To do this, its value must be
  1753  the path to the alternate build instructions file to use.
  1754  
  1755  The archive may include any number of other files,
  1756  which are accessible in the build context (See the [*ADD build
  1757  command*](../../reference/builder.md#add)).
  1758  
  1759  The Docker daemon performs a preliminary validation of the `Dockerfile` before
  1760  starting the build, and returns an error if the syntax is incorrect. After that,
  1761  each instruction is run one-by-one until the ID of the new image is output.
  1762  
  1763  The build is canceled if the client drops the connection by quitting
  1764  or being killed.
  1765  
  1766  **Query parameters**:
  1767  
  1768  -   **dockerfile** - Path within the build context to the `Dockerfile`. This is
  1769          ignored if `remote` is specified and points to an external `Dockerfile`.
  1770  -   **t** – A name and optional tag to apply to the image in the `name:tag` format.
  1771          If you omit the `tag` the default `latest` value is assumed.
  1772          You can provide one or more `t` parameters.
  1773  -   **remote** – A Git repository URI or HTTP/HTTPS context URI. If the
  1774          URI points to a single text file, the file's contents are placed into
  1775          a file called `Dockerfile` and the image is built from that file. If
  1776          the URI points to a tarball, the file is downloaded by the daemon and
  1777          the contents therein used as the context for the build. If the URI
  1778          points to a tarball and the `dockerfile` parameter is also specified,
  1779          there must be a file with the corresponding path inside the tarball.
  1780  -   **q** – Suppress verbose build output.
  1781  -   **nocache** – Do not use the cache when building the image.
  1782  -   **cachefrom** - JSON array of images used for build cache resolution.
  1783  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1784  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1785  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1786  -   **memory** - Set memory limit for build.
  1787  -   **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
  1788  -   **cpushares** - CPU shares (relative weight).
  1789  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1790  -   **cpuperiod** - The length of a CPU period in microseconds.
  1791  -   **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
  1792  -   **buildargs** – JSON map of string pairs for build-time variables. Users pass
  1793          these values at build-time. Docker uses the `buildargs` as the environment
  1794          context for command(s) run via the Dockerfile's `RUN` instruction or for
  1795          variable expansion in other Dockerfile instructions. This is not meant for
  1796          passing secret values. [Read more about the buildargs instruction](../../reference/builder.md#arg)
  1797  -   **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
  1798  -   **labels** – JSON map of string pairs for labels to set on the image.
  1799  -   **networkmode** - Sets the networking mode for the run commands during
  1800          build. Supported standard values are: `bridge`, `host`, `none`, and
  1801          `container:<name|id>`. Any other value is taken as a custom network's
  1802          name to which this container should connect to.
  1803  
  1804  
  1805  **Request Headers**:
  1806  
  1807  -   **Content-type** – Set to `"application/tar"`.
  1808  -   **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
  1809          object with the following structure:
  1810  
  1811              {
  1812                  "docker.example.com": {
  1813                      "username": "janedoe",
  1814                      "password": "hunter2"
  1815                  },
  1816                  "https://index.docker.io/v1/": {
  1817                      "username": "mobydock",
  1818                      "password": "conta1n3rize14"
  1819                  }
  1820              }
  1821  
  1822      This object maps the hostname of a registry to an object containing the
  1823      "username" and "password" for that registry. Multiple registries may
  1824      be specified as the build may be based on an image requiring
  1825      authentication to pull from any arbitrary registry. Only the registry
  1826      domain name (and port if not the default "443") are required. However
  1827      (for legacy reasons) the "official" Docker, Inc. hosted registry must
  1828      be specified with both a "https://" prefix and a "/v1/" suffix even
  1829      though Docker will prefer to use the v2 registry API.
  1830  
  1831  **Status codes**:
  1832  
  1833  -   **200** – no error
  1834  -   **500** – server error
  1835  
  1836  ### Create an image
  1837  
  1838  `POST /images/create`
  1839  
  1840  Create an image either by pulling it from the registry or by importing it
  1841  
  1842  **Example request**:
  1843  
  1844      POST /images/create?fromImage=busybox&tag=latest HTTP/1.1
  1845  
  1846  **Example response**:
  1847  
  1848      HTTP/1.1 200 OK
  1849      Content-Type: application/json
  1850  
  1851      {"status":"Pulling from library/busybox","id":"latest"}
  1852      {"status":"Pulling fs layer","progressDetail":{},"id":"8ddc19f16526"}
  1853      {"status":"Downloading","progressDetail":{"current":15881,"total":667590},"progress":"[=\u003e                                                 ] 15.88 kB/667.6 kB","id":"8ddc19f16526"}
  1854      {"status":"Downloading","progressDetail":{"current":556269,"total":667590},"progress":"[=========================================\u003e         ] 556.3 kB/667.6 kB","id":"8ddc19f16526"}
  1855      {"status":"Download complete","progressDetail":{},"id":"8ddc19f16526"}
  1856      {"status":"Extracting","progressDetail":{"current":32768,"total":667590},"progress":"[==\u003e                                                ] 32.77 kB/667.6 kB","id":"8ddc19f16526"}
  1857      {"status":"Extracting","progressDetail":{"current":491520,"total":667590},"progress":"[====================================\u003e              ] 491.5 kB/667.6 kB","id":"8ddc19f16526"}
  1858      {"status":"Extracting","progressDetail":{"current":667590,"total":667590},"progress":"[==================================================\u003e] 667.6 kB/667.6 kB","id":"8ddc19f16526"}
  1859      {"status":"Extracting","progressDetail":{"current":667590,"total":667590},"progress":"[==================================================\u003e] 667.6 kB/667.6 kB","id":"8ddc19f16526"}
  1860      {"status":"Pull complete","progressDetail":{},"id":"8ddc19f16526"}
  1861      {"status":"Digest: sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"}
  1862      {"status":"Status: Downloaded newer image for busybox:latest"}
  1863      ...
  1864  
  1865  When using this endpoint to pull an image from the registry, the
  1866  `X-Registry-Auth` header can be used to include
  1867  a base64-encoded AuthConfig object.
  1868  
  1869  **Query parameters**:
  1870  
  1871  -   **fromImage** – Name of the image to pull. The name may include a tag or
  1872          digest. This parameter may only be used when pulling an image.
  1873          The pull is cancelled if the HTTP connection is closed.
  1874  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1875          can be retrieved or `-` to read the image from the request body.
  1876          This parameter may only be used when importing an image.
  1877  -   **repo** – Repository name given to an image when it is imported.
  1878          The repo may include a tag. This parameter may only be used when importing
  1879          an image.
  1880  -   **tag** – Tag or digest. If empty when pulling an image, this causes all tags
  1881          for the given image to be pulled.
  1882  
  1883  **Request Headers**:
  1884  
  1885  -   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
  1886      - Credential based login:
  1887  
  1888          ```
  1889      {
  1890              "username": "jdoe",
  1891              "password": "secret",
  1892              "email": "jdoe@acme.com"
  1893      }
  1894          ```
  1895  
  1896      - Token based login:
  1897  
  1898          ```
  1899      {
  1900              "identitytoken": "9cbaf023786cd7..."
  1901      }
  1902          ```
  1903  
  1904  **Status codes**:
  1905  
  1906  -   **200** – no error
  1907  -   **500** – server error
  1908  
  1909  
  1910  
  1911  ### Inspect an image
  1912  
  1913  `GET /images/(name)/json`
  1914  
  1915  Return low-level information on the image `name`
  1916  
  1917  **Example request**:
  1918  
  1919      GET /images/example/json HTTP/1.1
  1920  
  1921  **Example response (Linux daemon)**:
  1922  
  1923      HTTP/1.1 200 OK
  1924      Content-Type: application/json
  1925  
  1926      {
  1927         "Id" : "sha256:85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
  1928         "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
  1929         "Comment" : "",
  1930         "Os" : "linux",
  1931         "Architecture" : "amd64",
  1932         "Parent" : "sha256:91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1933         "ContainerConfig" : {
  1934            "Tty" : false,
  1935            "Hostname" : "e611e15f9c9d",
  1936            "Volumes" : null,
  1937            "Domainname" : "",
  1938            "AttachStdout" : false,
  1939            "PublishService" : "",
  1940            "AttachStdin" : false,
  1941            "OpenStdin" : false,
  1942            "StdinOnce" : false,
  1943            "NetworkDisabled" : false,
  1944            "OnBuild" : [],
  1945            "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1946            "User" : "",
  1947            "WorkingDir" : "",
  1948            "Entrypoint" : null,
  1949            "MacAddress" : "",
  1950            "AttachStderr" : false,
  1951            "Labels" : {
  1952               "com.example.license" : "GPL",
  1953               "com.example.version" : "1.0",
  1954               "com.example.vendor" : "Acme"
  1955            },
  1956            "Env" : [
  1957               "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  1958            ],
  1959            "ExposedPorts" : null,
  1960            "Cmd" : [
  1961               "/bin/sh",
  1962               "-c",
  1963               "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
  1964            ]
  1965         },
  1966         "DockerVersion" : "1.9.0-dev",
  1967         "VirtualSize" : 188359297,
  1968         "Size" : 0,
  1969         "Author" : "",
  1970         "Created" : "2015-09-10T08:30:53.26995814Z",
  1971         "GraphDriver" : {
  1972            "Name" : "aufs",
  1973            "Data" : null
  1974         },
  1975         "RepoDigests" : [
  1976            "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1977         ],
  1978         "RepoTags" : [
  1979            "example:1.0",
  1980            "example:latest",
  1981            "example:stable"
  1982         ],
  1983         "Config" : {
  1984            "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1985            "NetworkDisabled" : false,
  1986            "OnBuild" : [],
  1987            "StdinOnce" : false,
  1988            "PublishService" : "",
  1989            "AttachStdin" : false,
  1990            "OpenStdin" : false,
  1991            "Domainname" : "",
  1992            "AttachStdout" : false,
  1993            "Tty" : false,
  1994            "Hostname" : "e611e15f9c9d",
  1995            "Volumes" : null,
  1996            "Cmd" : [
  1997               "/bin/bash"
  1998            ],
  1999            "ExposedPorts" : null,
  2000            "Env" : [
  2001               "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  2002            ],
  2003            "Labels" : {
  2004               "com.example.vendor" : "Acme",
  2005               "com.example.version" : "1.0",
  2006               "com.example.license" : "GPL"
  2007            },
  2008            "Entrypoint" : null,
  2009            "MacAddress" : "",
  2010            "AttachStderr" : false,
  2011            "WorkingDir" : "",
  2012            "User" : ""
  2013         },
  2014         "RootFS": {
  2015             "Type": "layers",
  2016             "Layers": [
  2017                 "sha256:1834950e52ce4d5a88a1bbd131c537f4d0e56d10ff0dd69e66be3b7dfa9df7e6",
  2018                 "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef"
  2019             ]
  2020         }
  2021      }
  2022  
  2023  **Example response (Windows daemon)**:
  2024  
  2025      HTTP/1.1 200 OK
  2026      Content-Type: application/json
  2027  
  2028      [
  2029          {
  2030              "Id": "sha256:105d76d0f40e38427c63023ffe649bf36fa85058d3469551e43e4dcc2431fb31",
  2031              "RepoTags": [
  2032                  "microsoft/nanoserver:latest"
  2033              ],
  2034              "RepoDigests": [
  2035                  "microsoft/nanoserver@sha256:aee7d4330fe3dc5987c808f647441c16ed2fa1c7d9c6ef49d6498e5c9860b50b"
  2036              ],
  2037              "Parent": "",
  2038              "Comment": "",
  2039              "Created": "2016-09-22T02:39:30.9154862-07:00",
  2040              "Container": "",
  2041              "ContainerConfig": {
  2042                  "Hostname": "",
  2043                  "Domainname": "",
  2044                  "User": "",
  2045                  "AttachStdin": false,
  2046                  "AttachStdout": false,
  2047                  "AttachStderr": false,
  2048                  "Tty": false,
  2049                  "OpenStdin": false,
  2050                  "StdinOnce": false,
  2051                  "Env": null,
  2052                  "Cmd": null,
  2053                  "Image": "",
  2054                  "Volumes": null,
  2055                  "WorkingDir": "",
  2056                  "Entrypoint": null,
  2057                  "OnBuild": null,
  2058                  "Labels": null
  2059              },
  2060              "DockerVersion": "",
  2061              "Author": "",
  2062              "Config": {
  2063                  "Hostname": "",
  2064                  "Domainname": "",
  2065                  "User": "",
  2066                  "AttachStdin": false,
  2067                  "AttachStdout": false,
  2068                  "AttachStderr": false,
  2069                  "Tty": false,
  2070                  "OpenStdin": false,
  2071                  "StdinOnce": false,
  2072                  "Env": null,
  2073                  "Cmd": [
  2074                      "c:\\windows\\system32\\cmd.exe"
  2075                  ],
  2076                  "Image": "",
  2077                  "Volumes": null,
  2078                  "WorkingDir": "",
  2079                  "Entrypoint": null,
  2080                  "OnBuild": null,
  2081                  "Labels": null
  2082              },
  2083              "Architecture": "",
  2084              "Os": "windows",
  2085              "OsVersion": "10.0.14393",
  2086              "Size": 651862727,
  2087              "VirtualSize": 651862727,
  2088              "GraphDriver": {
  2089                  "Name": "windowsfilter",
  2090                  "Data": {
  2091                      "dir": "C:\\control\\windowsfilter\\6fe6a289b98276a6a5ca0345156ca61d7b38f3da6bb49ef95af1d0f1ac37e5bf"
  2092                  }
  2093              },
  2094              "RootFS": {
  2095                  "Type": "layers",
  2096                  "Layers": [
  2097                      "sha256:342d4e407550c52261edd20cd901b5ce438f0b1e940336de3978210612365063"
  2098                  ]
  2099              }
  2100          }
  2101      ]
  2102  
  2103  **Status codes**:
  2104  
  2105  -   **200** – no error
  2106  -   **404** – no such image
  2107  -   **500** – server error
  2108  
  2109  ### Get the history of an image
  2110  
  2111  `GET /images/(name)/history`
  2112  
  2113  Return the history of the image `name`
  2114  
  2115  **Example request**:
  2116  
  2117      GET /images/ubuntu/history HTTP/1.1
  2118  
  2119  **Example response**:
  2120  
  2121      HTTP/1.1 200 OK
  2122      Content-Type: application/json
  2123  
  2124      [
  2125          {
  2126              "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
  2127              "Created": 1398108230,
  2128              "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
  2129              "Tags": [
  2130                  "ubuntu:lucid",
  2131                  "ubuntu:10.04"
  2132              ],
  2133              "Size": 182964289,
  2134              "Comment": ""
  2135          },
  2136          {
  2137              "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
  2138              "Created": 1398108222,
  2139              "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/",
  2140              "Tags": null,
  2141              "Size": 0,
  2142              "Comment": ""
  2143          },
  2144          {
  2145              "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
  2146              "Created": 1371157430,
  2147              "CreatedBy": "",
  2148              "Tags": [
  2149                  "scratch12:latest",
  2150                  "scratch:latest"
  2151              ],
  2152              "Size": 0,
  2153              "Comment": "Imported from -"
  2154          }
  2155      ]
  2156  
  2157  **Status codes**:
  2158  
  2159  -   **200** – no error
  2160  -   **404** – no such image
  2161  -   **500** – server error
  2162  
  2163  ### Push an image on the registry
  2164  
  2165  `POST /images/(name)/push`
  2166  
  2167  Push the image `name` on the registry
  2168  
  2169  **Example request**:
  2170  
  2171      POST /images/test/push HTTP/1.1
  2172  
  2173  **Example response**:
  2174  
  2175      HTTP/1.1 200 OK
  2176      Content-Type: application/json
  2177  
  2178      {"status": "Pushing..."}
  2179      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  2180      {"error": "Invalid..."}
  2181      ...
  2182  
  2183  If you wish to push an image on to a private registry, that image must already have a tag
  2184  into a repository which references that registry `hostname` and `port`.  This repository name should
  2185  then be used in the URL. This duplicates the command line's flow.
  2186  
  2187  The push is cancelled if the HTTP connection is closed.
  2188  
  2189  **Example request**:
  2190  
  2191      POST /images/registry.acme.com:5000/test/push HTTP/1.1
  2192  
  2193  
  2194  **Query parameters**:
  2195  
  2196  -   **tag** – The tag to associate with the image on the registry. This is optional.
  2197  
  2198  **Request Headers**:
  2199  
  2200  -   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
  2201      - Credential based login:
  2202  
  2203          ```
  2204      {
  2205              "username": "jdoe",
  2206              "password": "secret",
  2207              "email": "jdoe@acme.com",
  2208      }
  2209          ```
  2210  
  2211      - Identity token based login:
  2212  
  2213          ```
  2214      {
  2215              "identitytoken": "9cbaf023786cd7..."
  2216      }
  2217          ```
  2218  
  2219  **Status codes**:
  2220  
  2221  -   **200** – no error
  2222  -   **404** – no such image
  2223  -   **500** – server error
  2224  
  2225  ### Tag an image into a repository
  2226  
  2227  `POST /images/(name)/tag`
  2228  
  2229  Tag the image `name` into a repository
  2230  
  2231  **Example request**:
  2232  
  2233      POST /images/test/tag?repo=myrepo&tag=v42 HTTP/1.1
  2234  
  2235  **Example response**:
  2236  
  2237      HTTP/1.1 201 Created
  2238  
  2239  **Query parameters**:
  2240  
  2241  -   **repo** – The repository to tag in
  2242  -   **tag** - The new tag name
  2243  
  2244  **Status codes**:
  2245  
  2246  -   **201** – no error
  2247  -   **400** – bad parameter
  2248  -   **404** – no such image
  2249  -   **409** – conflict
  2250  -   **500** – server error
  2251  
  2252  ### Remove an image
  2253  
  2254  `DELETE /images/(name)`
  2255  
  2256  Remove the image `name` from the filesystem
  2257  
  2258  **Example request**:
  2259  
  2260      DELETE /images/test HTTP/1.1
  2261  
  2262  **Example response**:
  2263  
  2264      HTTP/1.1 200 OK
  2265      Content-type: application/json
  2266  
  2267      [
  2268       {"Untagged": "3e2f21a89f"},
  2269       {"Deleted": "3e2f21a89f"},
  2270       {"Deleted": "53b4f83ac9"}
  2271      ]
  2272  
  2273  **Query parameters**:
  2274  
  2275  -   **force** – 1/True/true or 0/False/false, default false
  2276  -   **noprune** – 1/True/true or 0/False/false, default false
  2277  
  2278  **Status codes**:
  2279  
  2280  -   **200** – no error
  2281  -   **404** – no such image
  2282  -   **409** – conflict
  2283  -   **500** – server error
  2284  
  2285  ### Search images
  2286  
  2287  `GET /images/search`
  2288  
  2289  Search for an image on [Docker Hub](https://hub.docker.com).
  2290  
  2291  > **Note**:
  2292  > The response keys have changed from API v1.6 to reflect the JSON
  2293  > sent by the registry server to the docker daemon's request.
  2294  
  2295  **Example request**:
  2296  
  2297      GET /images/search?term=sshd HTTP/1.1
  2298  
  2299  **Example response**:
  2300  
  2301      HTTP/1.1 200 OK
  2302      Content-Type: application/json
  2303  
  2304      [
  2305              {
  2306                  "description": "",
  2307                  "is_official": false,
  2308                  "is_automated": false,
  2309                  "name": "wma55/u1210sshd",
  2310                  "star_count": 0
  2311              },
  2312              {
  2313                  "description": "",
  2314                  "is_official": false,
  2315                  "is_automated": false,
  2316                  "name": "jdswinbank/sshd",
  2317                  "star_count": 0
  2318              },
  2319              {
  2320                  "description": "",
  2321                  "is_official": false,
  2322                  "is_automated": false,
  2323                  "name": "vgauthier/sshd",
  2324                  "star_count": 0
  2325              }
  2326      ...
  2327      ]
  2328  
  2329  **Query parameters**:
  2330  
  2331  -   **term** – term to search
  2332  -   **limit** – maximum returned search results
  2333  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  2334    -   `stars=<number>`
  2335    -   `is-automated=(true|false)`
  2336    -   `is-official=(true|false)`
  2337  
  2338  **Status codes**:
  2339  
  2340  -   **200** – no error
  2341  -   **500** – server error
  2342  
  2343  ### Prune unused images
  2344  
  2345  `POST /images/prune`
  2346  
  2347  Delete unused images
  2348  
  2349  **Example request**:
  2350  
  2351      POST /images/prune HTTP/1.1
  2352      Content-Type: application/json
  2353  
  2354      {
  2355          "DanglingOnly": false
  2356      }
  2357  
  2358  **Example response**:
  2359  
  2360      HTTP/1.1 200 OK
  2361      Content-Type: application/json
  2362  
  2363      {
  2364          "ImagesDeleted": [
  2365              {
  2366                  "Untagged": "busybox:latest"
  2367              },
  2368              {
  2369                  "Untagged": "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
  2370              },
  2371              {
  2372                  "Deleted": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749"
  2373              },
  2374              {
  2375                  "Deleted": "sha256:8ac8bfaff55af948c796026ee867448c5b5b5d9dd3549f4006d9759b25d4a893"
  2376              }
  2377          ],
  2378          "SpaceReclaimed": 1092588
  2379      }
  2380  
  2381  **JSON parameters**:
  2382  
  2383  - **DanglingOnly**: if `true` only delete unused *and* untagged images. Default to `false` if omitted
  2384  
  2385  **Status codes**:
  2386  
  2387  -   **200** – no error
  2388  -   **500** – server error
  2389  
  2390  
  2391  ## 3.3 Misc
  2392  
  2393  ### Check auth configuration
  2394  
  2395  `POST /auth`
  2396  
  2397  Validate credentials for a registry and get identity token,
  2398  if available, for accessing the registry without password.
  2399  
  2400  **Example request**:
  2401  
  2402      POST /auth HTTP/1.1
  2403      Content-Type: application/json
  2404  
  2405      {
  2406           "username": "hannibal",
  2407           "password": "xxxx",
  2408           "serveraddress": "https://index.docker.io/v1/"
  2409      }
  2410  
  2411  **Example response**:
  2412  
  2413      HTTP/1.1 200 OK
  2414  
  2415      {
  2416           "Status": "Login Succeeded",
  2417           "IdentityToken": "9cbaf023786cd7..."
  2418      }
  2419  
  2420  **Status codes**:
  2421  
  2422  -   **200** – no error
  2423  -   **204** – no error
  2424  -   **500** – server error
  2425  
  2426  ### Display system-wide information
  2427  
  2428  `GET /info`
  2429  
  2430  Display system-wide information
  2431  
  2432  **Example request**:
  2433  
  2434      GET /info HTTP/1.1
  2435  
  2436  **Example response (Linux)**:
  2437  
  2438      HTTP/1.1 200 OK
  2439      Content-Type: application/json
  2440  
  2441      {
  2442          "Architecture": "x86_64",
  2443          "ClusterStore": "etcd://localhost:2379",
  2444          "CgroupDriver": "cgroupfs",
  2445          "Containers": 11,
  2446          "ContainersRunning": 7,
  2447          "ContainersStopped": 3,
  2448          "ContainersPaused": 1,
  2449          "CpuCfsPeriod": true,
  2450          "CpuCfsQuota": true,
  2451          "Debug": false,
  2452          "DockerRootDir": "/var/lib/docker",
  2453          "Driver": "btrfs",
  2454          "DriverStatus": [[""]],
  2455          "ExperimentalBuild": false,
  2456          "HttpProxy": "http://test:test@localhost:8080",
  2457          "HttpsProxy": "https://test:test@localhost:8080",
  2458          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  2459          "IPv4Forwarding": true,
  2460          "Images": 16,
  2461          "IndexServerAddress": "https://index.docker.io/v1/",
  2462          "InitPath": "/usr/bin/docker",
  2463          "InitSha1": "",
  2464          "KernelMemory": true,
  2465          "KernelVersion": "3.12.0-1-amd64",
  2466          "Labels": [
  2467              "storage=ssd"
  2468          ],
  2469          "MemTotal": 2099236864,
  2470          "MemoryLimit": true,
  2471          "NCPU": 1,
  2472          "NEventsListener": 0,
  2473          "NFd": 11,
  2474          "NGoroutines": 21,
  2475          "Name": "prod-server-42",
  2476          "NoProxy": "9.81.1.160",
  2477          "OomKillDisable": true,
  2478          "OSType": "linux",
  2479          "OperatingSystem": "Boot2Docker",
  2480          "Plugins": {
  2481              "Volume": [
  2482                  "local"
  2483              ],
  2484              "Network": [
  2485                  "null",
  2486                  "host",
  2487                  "bridge"
  2488              ]
  2489          },
  2490          "RegistryConfig": {
  2491              "IndexConfigs": {
  2492                  "docker.io": {
  2493                      "Mirrors": null,
  2494                      "Name": "docker.io",
  2495                      "Official": true,
  2496                      "Secure": true
  2497                  }
  2498              },
  2499              "InsecureRegistryCIDRs": [
  2500                  "127.0.0.0/8"
  2501              ]
  2502          },
  2503          "SecurityOptions": [
  2504              "apparmor",
  2505              "seccomp",
  2506              "selinux"
  2507          ],
  2508          "ServerVersion": "1.9.0",
  2509          "SwapLimit": false,
  2510          "SystemStatus": [["State", "Healthy"]],
  2511          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  2512      }
  2513  
  2514  
  2515  **Example response (Windows)**:
  2516  
  2517      HTTP/1.1 200 OK
  2518      Content-Type: application/json
  2519  
  2520      {
  2521          "ID": "NYMS:B5VK:UMSL:FVDZ:EWB5:FKVK:LPFL:FJMQ:H6FT:BZJ6:L2TD:XH62",
  2522          "Containers": 1,
  2523          "ContainersRunning": 0,
  2524          "ContainersPaused": 0,
  2525          "ContainersStopped": 1,
  2526          "Images": 17,
  2527          "Driver": "windowsfilter",
  2528          "DriverStatus": [
  2529              ["Windows", ""]
  2530          ],
  2531          "SystemStatus": null,
  2532              "Plugins": {
  2533                  "Volume": ["local"],
  2534                  "Network": ["nat", "null", "overlay"],
  2535                  "Authorization": null
  2536              },
  2537          "MemoryLimit": false,
  2538          "SwapLimit": false,
  2539          "KernelMemory": false,
  2540          "CpuCfsPeriod": false,
  2541          "CpuCfsQuota": false,
  2542          "CPUShares": false,
  2543          "CPUSet": false,
  2544          "IPv4Forwarding": true,
  2545          "BridgeNfIptables": true,
  2546          "BridgeNfIp6tables": true,
  2547          "Debug": false,
  2548          "NFd": -1,
  2549          "OomKillDisable": false,
  2550          "NGoroutines": 11,
  2551          "SystemTime": "2016-09-23T11:59:58.9843533-07:00",
  2552          "LoggingDriver": "json-file",
  2553          "CgroupDriver": "",
  2554          "NEventsListener": 0,
  2555          "KernelVersion": "10.0 14393 (14393.206.amd64fre.rs1_release.160912-1937)",
  2556          "OperatingSystem": "Windows Server 2016 Datacenter",
  2557          "OSType": "windows",
  2558          "Architecture": "x86_64",
  2559          "IndexServerAddress": "https://index.docker.io/v1/",
  2560          "RegistryConfig": {
  2561                  "InsecureRegistryCIDRs": ["127.0.0.0/8"],
  2562                  "IndexConfigs": {
  2563                      "docker.io": {
  2564                          "Name": "docker.io",
  2565                          "Mirrors": null,
  2566                          "Secure": true,
  2567                          "Official": true
  2568                      }
  2569                  },
  2570                  "Mirrors": null
  2571          },
  2572          "NCPU": 8,
  2573          "MemTotal": 4293828608,
  2574          "DockerRootDir": "C:\\control",
  2575          "HttpProxy": "",
  2576          "HttpsProxy": "",
  2577          "NoProxy": "",
  2578          "Name": "WIN-V0V70C0LU5P",
  2579          "Labels": null,
  2580          "ExperimentalBuild": false,
  2581          "ServerVersion": "1.13.0-dev",
  2582          "ClusterStore": "",
  2583          "ClusterAdvertise": "",
  2584          "SecurityOptions": null,
  2585          "Runtimes": null,
  2586          "DefaultRuntime": "",
  2587          "Swarm": {
  2588              "NodeID": "",
  2589              "NodeAddr": "",
  2590              "LocalNodeState": "inactive",
  2591              "ControlAvailable": false,
  2592              "Error": "",
  2593              "RemoteManagers": null,
  2594              "Nodes": 0,
  2595              "Managers": 0,
  2596              "Cluster": {
  2597                  "ID": "",
  2598                  "Version": {},
  2599                  "CreatedAt": "0001-01-01T00:00:00Z",
  2600                  "UpdatedAt": "0001-01-01T00:00:00Z",
  2601                  "Spec": {
  2602                      "Orchestration": {},
  2603                      "Raft": {
  2604                          "ElectionTick": 0,
  2605                          "HeartbeatTick": 0
  2606                      },
  2607                      "Dispatcher": {},
  2608                      "CAConfig": {},
  2609                      "TaskDefaults": {}
  2610                  }
  2611              }
  2612          },
  2613          "LiveRestoreEnabled": false,
  2614          "Isolation": "process"
  2615      }
  2616  
  2617  **Status codes**:
  2618  
  2619  -   **200** – no error
  2620  -   **500** – server error
  2621  
  2622  ### Show docker data usage information
  2623  
  2624  `GET /system/df`
  2625  
  2626  Return docker data usage information
  2627  
  2628  **Example request**:
  2629  
  2630      GET /system/df HTTP/1.1
  2631  
  2632  **Example response**:
  2633  
  2634      {
  2635          "LayersSize": 1092588,
  2636          "Images": [
  2637              {
  2638                  "Id": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
  2639                  "ParentId": "",
  2640                  "RepoTags": [
  2641                      "busybox:latest"
  2642                  ],
  2643                  "RepoDigests": [
  2644                      "busybox@sha256:a59906e33509d14c036c8678d687bd4eec81ed7c4b8ce907b888c607f6a1e0e6"
  2645                  ],
  2646                  "Created": 1466724217,
  2647                  "Size": 1092588,
  2648                  "SharedSize": 0,
  2649                  "VirtualSize": 1092588,
  2650                  "Labels": {},
  2651                  "Containers": 1
  2652              }
  2653          ],
  2654          "Containers": [
  2655              {
  2656                  "Id": "e575172ed11dc01bfce087fb27bee502db149e1a0fad7c296ad300bbff178148",
  2657                  "Names": [
  2658                      "/top"
  2659                  ],
  2660                  "Image": "busybox",
  2661                  "ImageID": "sha256:2b8fd9751c4c0f5dd266fcae00707e67a2545ef34f9a29354585f93dac906749",
  2662                  "Command": "top",
  2663                  "Created": 1472592424,
  2664                  "Ports": [],
  2665                  "SizeRootFs": 1092588,
  2666                  "Labels": {},
  2667                  "State": "exited",
  2668                  "Status": "Exited (0) 56 minutes ago",
  2669                  "HostConfig": {
  2670                      "NetworkMode": "default"
  2671                  },
  2672                  "NetworkSettings": {
  2673                      "Networks": {
  2674                          "bridge": {
  2675                              "IPAMConfig": null,
  2676                              "Links": null,
  2677                              "Aliases": null,
  2678                              "NetworkID": "d687bc59335f0e5c9ee8193e5612e8aee000c8c62ea170cfb99c098f95899d92",
  2679                              "EndpointID": "8ed5115aeaad9abb174f68dcf135b49f11daf597678315231a32ca28441dec6a",
  2680                              "Gateway": "172.18.0.1",
  2681                              "IPAddress": "172.18.0.2",
  2682                              "IPPrefixLen": 16,
  2683                              "IPv6Gateway": "",
  2684                              "GlobalIPv6Address": "",
  2685                              "GlobalIPv6PrefixLen": 0,
  2686                              "MacAddress": "02:42:ac:12:00:02"
  2687                          }
  2688                      }
  2689                  },
  2690                  "Mounts": []
  2691              }
  2692          ],
  2693          "Volumes": [
  2694                  {
  2695                      "Name": "my-volume",
  2696                      "Driver": "local",
  2697                      "Mountpoint": "",
  2698                      "Labels": null,
  2699                      "Scope": "",
  2700                      "Options": null
  2701                      "UsageData": {
  2702                          "Size": 0,
  2703                          "RefCount": 0
  2704                      }
  2705                  }
  2706          ]
  2707      }
  2708  
  2709  **Status codes**:
  2710  
  2711  -   **200** – no error
  2712  -   **500** – server error
  2713  
  2714  ### Show the docker version information
  2715  
  2716  `GET /version`
  2717  
  2718  Show the docker version information
  2719  
  2720  **Example request**:
  2721  
  2722      GET /version HTTP/1.1
  2723  
  2724  **Example response**:
  2725  
  2726      HTTP/1.1 200 OK
  2727      Content-Type: application/json
  2728  
  2729      {
  2730           "Version": "1.13.0",
  2731           "Os": "linux",
  2732           "KernelVersion": "3.19.0-23-generic",
  2733           "GoVersion": "go1.6.3",
  2734           "GitCommit": "deadbee",
  2735           "Arch": "amd64",
  2736           "ApiVersion": "1.25",
  2737           "BuildTime": "2016-06-14T07:09:13.444803460+00:00",
  2738           "Experimental": true
  2739      }
  2740  
  2741  **Status codes**:
  2742  
  2743  -   **200** – no error
  2744  -   **500** – server error
  2745  
  2746  ### Ping the docker server
  2747  
  2748  `GET /_ping`
  2749  
  2750  Ping the docker server
  2751  
  2752  **Example request**:
  2753  
  2754      GET /_ping HTTP/1.1
  2755  
  2756  **Example response**:
  2757  
  2758      HTTP/1.1 200 OK
  2759      Content-Type: text/plain
  2760  
  2761      OK
  2762  
  2763  **Status codes**:
  2764  
  2765  -   **200** - no error
  2766  -   **500** - server error
  2767  
  2768  ### Create a new image from a container's changes
  2769  
  2770  `POST /commit`
  2771  
  2772  Create a new image from a container's changes
  2773  
  2774  **Example request**:
  2775  
  2776      POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  2777      Content-Type: application/json
  2778  
  2779      {
  2780           "Hostname": "",
  2781           "Domainname": "",
  2782           "User": "",
  2783           "AttachStdin": false,
  2784           "AttachStdout": true,
  2785           "AttachStderr": true,
  2786           "Tty": false,
  2787           "OpenStdin": false,
  2788           "StdinOnce": false,
  2789           "Env": null,
  2790           "Cmd": [
  2791                   "date"
  2792           ],
  2793           "Mounts": [
  2794             {
  2795               "Source": "/data",
  2796               "Destination": "/data",
  2797               "Mode": "ro,Z",
  2798               "RW": false
  2799             }
  2800           ],
  2801           "Labels": {
  2802                   "key1": "value1",
  2803                   "key2": "value2"
  2804            },
  2805           "WorkingDir": "",
  2806           "NetworkDisabled": false,
  2807           "ExposedPorts": {
  2808                   "22/tcp": {}
  2809           }
  2810      }
  2811  
  2812  **Example response**:
  2813  
  2814      HTTP/1.1 201 Created
  2815      Content-Type: application/json
  2816  
  2817      {"Id": "596069db4bf5"}
  2818  
  2819  **JSON parameters**:
  2820  
  2821  -  **config** - the container's configuration
  2822  
  2823  **Query parameters**:
  2824  
  2825  -   **container** – source container
  2826  -   **repo** – repository
  2827  -   **tag** – tag
  2828  -   **comment** – commit message
  2829  -   **author** – author (e.g., "John Hannibal Smith
  2830      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  2831  -   **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
  2832  -   **changes** – Dockerfile instructions to apply while committing
  2833  
  2834  **Status codes**:
  2835  
  2836  -   **201** – no error
  2837  -   **404** – no such container
  2838  -   **500** – server error
  2839  
  2840  ### Monitor Docker's events
  2841  
  2842  `GET /events`
  2843  
  2844  Get container events from docker, in real time via streaming.
  2845  
  2846  Docker containers report the following events:
  2847  
  2848      attach, commit, copy, create, destroy, detach, die, exec_create, exec_detach, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
  2849  
  2850  Docker images report the following events:
  2851  
  2852      delete, import, load, pull, push, save, tag, untag
  2853  
  2854  Docker volumes report the following events:
  2855  
  2856      create, mount, unmount, destroy
  2857  
  2858  Docker networks report the following events:
  2859  
  2860      create, connect, disconnect, destroy
  2861  
  2862  Docker daemon report the following event:
  2863  
  2864      reload
  2865  
  2866  **Example request**:
  2867  
  2868      GET /events?since=1374067924
  2869  
  2870  **Example response**:
  2871  
  2872      HTTP/1.1 200 OK
  2873      Content-Type: application/json
  2874      Server: Docker/1.11.0 (linux)
  2875      Date: Fri, 29 Apr 2016 15:18:06 GMT
  2876      Transfer-Encoding: chunked
  2877  
  2878      {
  2879        "status": "pull",
  2880        "id": "alpine:latest",
  2881        "Type": "image",
  2882        "Action": "pull",
  2883        "Actor": {
  2884          "ID": "alpine:latest",
  2885          "Attributes": {
  2886            "name": "alpine"
  2887          }
  2888        },
  2889        "time": 1461943101,
  2890        "timeNano": 1461943101301854122
  2891      }
  2892      {
  2893        "status": "create",
  2894        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2895        "from": "alpine",
  2896        "Type": "container",
  2897        "Action": "create",
  2898        "Actor": {
  2899          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2900          "Attributes": {
  2901            "com.example.some-label": "some-label-value",
  2902            "image": "alpine",
  2903            "name": "my-container"
  2904          }
  2905        },
  2906        "time": 1461943101,
  2907        "timeNano": 1461943101381709551
  2908      }
  2909      {
  2910        "status": "attach",
  2911        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2912        "from": "alpine",
  2913        "Type": "container",
  2914        "Action": "attach",
  2915        "Actor": {
  2916          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2917          "Attributes": {
  2918            "com.example.some-label": "some-label-value",
  2919            "image": "alpine",
  2920            "name": "my-container"
  2921          }
  2922        },
  2923        "time": 1461943101,
  2924        "timeNano": 1461943101383858412
  2925      }
  2926      {
  2927        "Type": "network",
  2928        "Action": "connect",
  2929        "Actor": {
  2930          "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
  2931          "Attributes": {
  2932            "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2933            "name": "bridge",
  2934            "type": "bridge"
  2935          }
  2936        },
  2937        "time": 1461943101,
  2938        "timeNano": 1461943101394865557
  2939      }
  2940      {
  2941        "status": "start",
  2942        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2943        "from": "alpine",
  2944        "Type": "container",
  2945        "Action": "start",
  2946        "Actor": {
  2947          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2948          "Attributes": {
  2949            "com.example.some-label": "some-label-value",
  2950            "image": "alpine",
  2951            "name": "my-container"
  2952          }
  2953        },
  2954        "time": 1461943101,
  2955        "timeNano": 1461943101607533796
  2956      }
  2957      {
  2958        "status": "resize",
  2959        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2960        "from": "alpine",
  2961        "Type": "container",
  2962        "Action": "resize",
  2963        "Actor": {
  2964          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2965          "Attributes": {
  2966            "com.example.some-label": "some-label-value",
  2967            "height": "46",
  2968            "image": "alpine",
  2969            "name": "my-container",
  2970            "width": "204"
  2971          }
  2972        },
  2973        "time": 1461943101,
  2974        "timeNano": 1461943101610269268
  2975      }
  2976      {
  2977        "status": "die",
  2978        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2979        "from": "alpine",
  2980        "Type": "container",
  2981        "Action": "die",
  2982        "Actor": {
  2983          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  2984          "Attributes": {
  2985            "com.example.some-label": "some-label-value",
  2986            "exitCode": "0",
  2987            "image": "alpine",
  2988            "name": "my-container"
  2989          }
  2990        },
  2991        "time": 1461943105,
  2992        "timeNano": 1461943105079144137
  2993      }
  2994      {
  2995        "Type": "network",
  2996        "Action": "disconnect",
  2997        "Actor": {
  2998          "ID": "7dc8ac97d5d29ef6c31b6052f3938c1e8f2749abbd17d1bd1febf2608db1b474",
  2999          "Attributes": {
  3000            "container": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  3001            "name": "bridge",
  3002            "type": "bridge"
  3003          }
  3004        },
  3005        "time": 1461943105,
  3006        "timeNano": 1461943105230860245
  3007      }
  3008      {
  3009        "status": "destroy",
  3010        "id": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  3011        "from": "alpine",
  3012        "Type": "container",
  3013        "Action": "destroy",
  3014        "Actor": {
  3015          "ID": "ede54ee1afda366ab42f824e8a5ffd195155d853ceaec74a927f249ea270c743",
  3016          "Attributes": {
  3017            "com.example.some-label": "some-label-value",
  3018            "image": "alpine",
  3019            "name": "my-container"
  3020          }
  3021        },
  3022        "time": 1461943105,
  3023        "timeNano": 1461943105338056026
  3024      }
  3025  
  3026  **Query parameters**:
  3027  
  3028  -   **since** – Timestamp. Show all events created since timestamp and then stream
  3029  -   **until** – Timestamp. Show events created until given timestamp and stop streaming
  3030  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  3031    -   `container=<string>`; -- container to filter
  3032    -   `event=<string>`; -- event to filter
  3033    -   `image=<string>`; -- image to filter
  3034    -   `label=<string>`; -- image and container label to filter
  3035    -   `type=<string>`; -- either `container` or `image` or `volume` or `network` or `daemon`
  3036    -   `volume=<string>`; -- volume to filter
  3037    -   `network=<string>`; -- network to filter
  3038    -   `daemon=<string>`; -- daemon name or id to filter
  3039  
  3040  **Status codes**:
  3041  
  3042  -   **200** – no error
  3043  -   **500** – server error
  3044  
  3045  ### Get a tarball containing all images in a repository
  3046  
  3047  `GET /images/(name)/get`
  3048  
  3049  Get a tarball containing all images and metadata for the repository specified
  3050  by `name`.
  3051  
  3052  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  3053  (and its parents) are returned. If `name` is an image ID, similarly only that
  3054  image (and its parents) are returned, but with the exclusion of the
  3055  'repositories' file in the tarball, as there were no image names referenced.
  3056  
  3057  See the [image tarball format](#image-tarball-format) for more details.
  3058  
  3059  **Example request**
  3060  
  3061      GET /images/ubuntu/get
  3062  
  3063  **Example response**:
  3064  
  3065      HTTP/1.1 200 OK
  3066      Content-Type: application/x-tar
  3067  
  3068      Binary data stream
  3069  
  3070  **Status codes**:
  3071  
  3072  -   **200** – no error
  3073  -   **500** – server error
  3074  
  3075  ### Get a tarball containing all images
  3076  
  3077  `GET /images/get`
  3078  
  3079  Get a tarball containing all images and metadata for one or more repositories.
  3080  
  3081  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  3082  `ubuntu:latest`), then only that image (and its parents) are returned; if it is
  3083  an image ID, similarly only that image (and its parents) are returned and there
  3084  would be no names referenced in the 'repositories' file for this image ID.
  3085  
  3086  See the [image tarball format](#image-tarball-format) for more details.
  3087  
  3088  **Example request**
  3089  
  3090      GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  3091  
  3092  **Example response**:
  3093  
  3094      HTTP/1.1 200 OK
  3095      Content-Type: application/x-tar
  3096  
  3097      Binary data stream
  3098  
  3099  **Status codes**:
  3100  
  3101  -   **200** – no error
  3102  -   **500** – server error
  3103  
  3104  ### Load a tarball with a set of images and tags into docker
  3105  
  3106  `POST /images/load`
  3107  
  3108  Load a set of images and tags into a Docker repository.
  3109  See the [image tarball format](#image-tarball-format) for more details.
  3110  
  3111  **Example request**
  3112  
  3113      POST /images/load
  3114      Content-Type: application/x-tar
  3115  
  3116      Tarball in body
  3117  
  3118  **Example response**:
  3119  
  3120      HTTP/1.1 200 OK
  3121      Content-Type: application/json
  3122      Transfer-Encoding: chunked
  3123  
  3124      {"status":"Loading layer","progressDetail":{"current":32768,"total":1292800},"progress":"[=                                                 ] 32.77 kB/1.293 MB","id":"8ac8bfaff55a"}
  3125      {"status":"Loading layer","progressDetail":{"current":65536,"total":1292800},"progress":"[==                                                ] 65.54 kB/1.293 MB","id":"8ac8bfaff55a"}
  3126      {"status":"Loading layer","progressDetail":{"current":98304,"total":1292800},"progress":"[===                                               ]  98.3 kB/1.293 MB","id":"8ac8bfaff55a"}
  3127      {"status":"Loading layer","progressDetail":{"current":131072,"total":1292800},"progress":"[=====                                             ] 131.1 kB/1.293 MB","id":"8ac8bfaff55a"}
  3128      ...
  3129      {"stream":"Loaded image: busybox:latest\n"}
  3130  
  3131  **Example response**:
  3132  
  3133  If the "quiet" query parameter is set to `true` / `1` (`?quiet=1`), progress
  3134  details are suppressed, and only a confirmation message is returned once the
  3135  action completes.
  3136  
  3137      HTTP/1.1 200 OK
  3138      Content-Type: application/json
  3139      Transfer-Encoding: chunked
  3140  
  3141      {"stream":"Loaded image: busybox:latest\n"}
  3142  
  3143  **Query parameters**:
  3144  
  3145  -   **quiet** – Boolean value, suppress progress details during load. Defaults
  3146        to `0` / `false` if omitted.
  3147  
  3148  **Status codes**:
  3149  
  3150  -   **200** – no error
  3151  -   **500** – server error
  3152  
  3153  ### Image tarball format
  3154  
  3155  An image tarball contains one directory per image layer (named using its long ID),
  3156  each containing these files:
  3157  
  3158  - `VERSION`: currently `1.0` - the file format version
  3159  - `json`: detailed layer information, similar to `docker inspect layer_id`
  3160  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  3161  
  3162  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  3163  for storing attribute changes and deletions.
  3164  
  3165  If the tarball defines a repository, the tarball should also include a `repositories` file at
  3166  the root that contains a list of repository and tag names mapped to layer IDs.
  3167  
  3168  ```
  3169  {"hello-world":
  3170      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  3171  }
  3172  ```
  3173  
  3174  ### Exec Create
  3175  
  3176  `POST /containers/(id or name)/exec`
  3177  
  3178  Sets up an exec instance in a running container `id`
  3179  
  3180  **Example request**:
  3181  
  3182      POST /containers/e90e34656806/exec HTTP/1.1
  3183      Content-Type: application/json
  3184  
  3185      {
  3186        "AttachStdin": true,
  3187        "AttachStdout": true,
  3188        "AttachStderr": true,
  3189        "Cmd": ["sh"],
  3190        "DetachKeys": "ctrl-p,ctrl-q",
  3191        "Env": [
  3192          "FOO=bar",
  3193          "BAZ=quux"
  3194        ],
  3195        "Privileged": true,
  3196        "Tty": true,
  3197        "User": "123:456"
  3198      }
  3199  
  3200  **Example response**:
  3201  
  3202      HTTP/1.1 201 Created
  3203      Content-Type: application/json
  3204  
  3205      {
  3206           "Id": "f90e34656806",
  3207           "Warnings":[]
  3208      }
  3209  
  3210  **JSON parameters**:
  3211  
  3212  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  3213  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  3214  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  3215  -   **DetachKeys** – Override the key sequence for detaching a
  3216          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  3217          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  3218  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  3219  -   **Env** - A list of environment variables in the form of `["VAR=value", ...]`
  3220  -   **Cmd** - Command to run specified as a string or an array of strings.
  3221  -   **Privileged** - Boolean value, runs the exec process with extended privileges.
  3222  -   **User** - A string value specifying the user, and optionally, group to run
  3223          the exec process inside the container. Format is one of: `"user"`,
  3224          `"user:group"`, `"uid"`, or `"uid:gid"`.
  3225  
  3226  **Status codes**:
  3227  
  3228  -   **201** – no error
  3229  -   **404** – no such container
  3230  -   **409** - container is paused
  3231  -   **500** - server error
  3232  
  3233  ### Exec Start
  3234  
  3235  `POST /exec/(id)/start`
  3236  
  3237  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  3238  returns after starting the `exec` command. Otherwise, this API sets up an
  3239  interactive session with the `exec` command.
  3240  
  3241  **Example request**:
  3242  
  3243      POST /exec/e90e34656806/start HTTP/1.1
  3244      Content-Type: application/json
  3245  
  3246      {
  3247       "Detach": false,
  3248       "Tty": false
  3249      }
  3250  
  3251  **Example response**:
  3252  
  3253      HTTP/1.1 200 OK
  3254      Content-Type: application/vnd.docker.raw-stream
  3255  
  3256      {% raw %}
  3257      {{ STREAM }}
  3258      {% endraw %}
  3259  
  3260  **JSON parameters**:
  3261  
  3262  -   **Detach** - Detach from the `exec` command.
  3263  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  3264  
  3265  **Status codes**:
  3266  
  3267  -   **200** – no error
  3268  -   **404** – no such exec instance
  3269  -   **409** - container is paused
  3270  
  3271  **Stream details**:
  3272  
  3273  Similar to the stream behavior of `POST /containers/(id or name)/attach` API
  3274  
  3275  ### Exec Resize
  3276  
  3277  `POST /exec/(id)/resize`
  3278  
  3279  Resizes the `tty` session used by the `exec` command `id`.  The unit is number of characters.
  3280  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  3281  
  3282  **Example request**:
  3283  
  3284      POST /exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
  3285      Content-Type: text/plain
  3286  
  3287  **Example response**:
  3288  
  3289      HTTP/1.1 201 Created
  3290      Content-Type: text/plain
  3291  
  3292  **Query parameters**:
  3293  
  3294  -   **h** – height of `tty` session
  3295  -   **w** – width
  3296  
  3297  **Status codes**:
  3298  
  3299  -   **201** – no error
  3300  -   **404** – no such exec instance
  3301  
  3302  ### Exec Inspect
  3303  
  3304  `GET /exec/(id)/json`
  3305  
  3306  Return low-level information about the `exec` command `id`.
  3307  
  3308  **Example request**:
  3309  
  3310      GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  3311  
  3312  **Example response**:
  3313  
  3314      HTTP/1.1 200 OK
  3315      Content-Type: application/json
  3316  
  3317      {
  3318        "CanRemove": false,
  3319        "ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126",
  3320        "DetachKeys": "",
  3321        "ExitCode": 2,
  3322        "ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b",
  3323        "OpenStderr": true,
  3324        "OpenStdin": true,
  3325        "OpenStdout": true,
  3326        "ProcessConfig": {
  3327          "arguments": [
  3328            "-c",
  3329            "exit 2"
  3330          ],
  3331          "entrypoint": "sh",
  3332          "privileged": false,
  3333          "tty": true,
  3334          "user": "1000"
  3335        },
  3336        "Running": false,
  3337        "Pid": "42000"
  3338      }
  3339  
  3340  **Status codes**:
  3341  
  3342  -   **200** – no error
  3343  -   **404** – no such exec instance
  3344  -   **500** - server error
  3345  
  3346  ## 3.4 Volumes
  3347  
  3348  ### List volumes
  3349  
  3350  `GET /volumes`
  3351  
  3352  **Example request**:
  3353  
  3354      GET /volumes HTTP/1.1
  3355  
  3356  **Example response**:
  3357  
  3358      HTTP/1.1 200 OK
  3359      Content-Type: application/json
  3360  
  3361      {
  3362        "Volumes": [
  3363          {
  3364            "Name": "tardis",
  3365            "Driver": "local",
  3366            "Mountpoint": "/var/lib/docker/volumes/tardis",
  3367            "Labels":{
  3368              "com.example.some-label": "some-value",
  3369              "com.example.some-other-label": "some-other-value"
  3370            },
  3371            "Scope": "local",
  3372            "Options": {
  3373              "device": "tmpfs",
  3374              "o": "size=100m,uid=1000",
  3375              "type": "tmpfs"
  3376            }
  3377          }
  3378        ],
  3379        "Warnings": []
  3380      }
  3381  
  3382  **Query parameters**:
  3383  
  3384  - **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. Available filters:
  3385    -   `name=<volume-name>` Matches all or part of a volume name.
  3386    -   `dangling=<boolean>` When set to `true` (or `1`), returns all volumes that are "dangling" (not in use by a container). When set to `false` (or `0`), only volumes that are in use by one or more containers are returned.
  3387    -   `driver=<volume-driver-name>` Matches all or part of a volume driver name.
  3388  
  3389  **Status codes**:
  3390  
  3391  -   **200** - no error
  3392  -   **500** - server error
  3393  
  3394  ### Create a volume
  3395  
  3396  `POST /volumes/create`
  3397  
  3398  Create a volume
  3399  
  3400  **Example request**:
  3401  
  3402      POST /volumes/create HTTP/1.1
  3403      Content-Type: application/json
  3404  
  3405      {
  3406        "Name": "tardis",
  3407        "Labels": {
  3408          "com.example.some-label": "some-value",
  3409          "com.example.some-other-label": "some-other-value"
  3410        },
  3411        "Driver": "custom"
  3412      }
  3413  
  3414  **Example response**:
  3415  
  3416      HTTP/1.1 201 Created
  3417      Content-Type: application/json
  3418  
  3419      {
  3420        "Name": "tardis",
  3421        "Driver": "custom",
  3422        "Mountpoint": "/var/lib/docker/volumes/tardis",
  3423        "Status": {
  3424          "hello": "world"
  3425        },
  3426        "Labels": {
  3427          "com.example.some-label": "some-value",
  3428          "com.example.some-other-label": "some-other-value"
  3429        },
  3430        "Scope": "local",
  3431        "Options": null
  3432      }
  3433  
  3434  **Status codes**:
  3435  
  3436  - **201** - no error
  3437  - **500**  - server error
  3438  
  3439  **JSON parameters**:
  3440  
  3441  - **Name** - The new volume's name. If not specified, Docker generates a name.
  3442  - **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
  3443  - **DriverOpts** - A mapping of driver options and values. These options are
  3444      passed directly to the driver and are driver specific.
  3445  - **Labels** - Labels to set on the volume, specified as a map: `{"key":"value","key2":"value2"}`
  3446  
  3447  **JSON fields in response**:
  3448  
  3449  Refer to the [inspect a volume](#inspect-a-volume) section or details about the
  3450  JSON fields returned in the response.
  3451  
  3452  ### Inspect a volume
  3453  
  3454  `GET /volumes/(name)`
  3455  
  3456  Return low-level information on the volume `name`
  3457  
  3458  **Example request**:
  3459  
  3460      GET /volumes/tardis
  3461  
  3462  **Example response**:
  3463  
  3464      HTTP/1.1 200 OK
  3465      Content-Type: application/json
  3466  
  3467      {
  3468        "Name": "tardis",
  3469        "Driver": "custom",
  3470        "Mountpoint": "/var/lib/docker/volumes/tardis/_data",
  3471        "Status": {
  3472          "hello": "world"
  3473        },
  3474        "Labels": {
  3475            "com.example.some-label": "some-value",
  3476            "com.example.some-other-label": "some-other-value"
  3477        },
  3478        "Scope": "local",
  3479        "Options": {
  3480            "some-key": "some-value",
  3481            "some-other-key": "some-other-value"
  3482        },
  3483      }
  3484  
  3485  **Status codes**:
  3486  
  3487  -   **200** - no error
  3488  -   **404** - no such volume
  3489  -   **500** - server error
  3490  
  3491  **JSON fields in response**:
  3492  
  3493  The following fields can be returned in the API response. Empty fields, or
  3494  fields that are not supported by the volume's driver may be omitted in the
  3495  response.
  3496  
  3497  - **Name** - Name of the volume.
  3498  - **Driver** - Name of the volume driver used by the volume.
  3499  - **Mountpoint** - Mount path of the volume on the host.
  3500  - **Status** - Low-level details about the volume, provided by the volume driver.
  3501      Details are returned as a map with key/value pairs: `{"key":"value","key2":"value2"}`.
  3502      The `Status` field is optional, and is omitted if the volume driver does not
  3503      support this feature.
  3504  - **Labels** - Labels set on the volume, specified as a map: `{"key":"value","key2":"value2"}`.
  3505  - **Scope** - Scope describes the level at which the volume exists, can be one of
  3506      `global` for cluster-wide or `local` for machine level. The default is `local`.
  3507  - **Options** - Options holds the driver specific options to use for when creating the volume.
  3508  
  3509  ### Remove a volume
  3510  
  3511  `DELETE /volumes/(name)`
  3512  
  3513  Instruct the driver to remove the volume (`name`).
  3514  
  3515  **Example request**:
  3516  
  3517      DELETE /volumes/tardis HTTP/1.1
  3518  
  3519  **Example response**:
  3520  
  3521      HTTP/1.1 204 No Content
  3522  
  3523  **Query Parameters**:
  3524  
  3525  -   **force** - 1/True/true or 0/False/false, Force the removal of the volume.
  3526          Default `false`.
  3527  
  3528  **Status codes**:
  3529  
  3530  -   **204** - no error
  3531  -   **404** - no such volume or volume driver
  3532  -   **409** - volume is in use and cannot be removed
  3533  -   **500** - server error
  3534  
  3535  ### Prune unused volumes
  3536  
  3537  `POST /volumes/prune`
  3538  
  3539  Delete unused volumes
  3540  
  3541  **Example request**:
  3542  
  3543      POST /volumes/prune HTTP/1.1
  3544      Content-Type: application/json
  3545  
  3546      {
  3547      }
  3548  
  3549  **Example response**:
  3550  
  3551      HTTP/1.1 200 OK
  3552      Content-Type: application/json
  3553  
  3554      {
  3555          "VolumesDeleted": [
  3556              "my-volume"
  3557          ],
  3558          "SpaceReclaimed": 42
  3559      }
  3560  
  3561  **Status codes**:
  3562  
  3563  -   **200** – no error
  3564  -   **500** – server error
  3565  
  3566  
  3567  ## 3.5 Networks
  3568  
  3569  ### List networks
  3570  
  3571  `GET /networks`
  3572  
  3573  **Example request**:
  3574  
  3575      GET /networks?filters={"type":{"custom":true}} HTTP/1.1
  3576  
  3577  **Example response**:
  3578  
  3579  ```
  3580  HTTP/1.1 200 OK
  3581  Content-Type: application/json
  3582  
  3583  [
  3584    {
  3585      "Name": "bridge",
  3586      "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
  3587      "Created": "2016-10-19T06:21:00.416543526Z",
  3588      "Scope": "local",
  3589      "Driver": "bridge",
  3590      "EnableIPv6": false,
  3591      "Internal": false,
  3592      "IPAM": {
  3593        "Driver": "default",
  3594        "Config": [
  3595          {
  3596            "Subnet": "172.17.0.0/16"
  3597          }
  3598        ]
  3599      },
  3600      "Containers": {
  3601        "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
  3602          "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
  3603          "MacAddress": "02:42:ac:11:00:02",
  3604          "IPv4Address": "172.17.0.2/16",
  3605          "IPv6Address": ""
  3606        }
  3607      },
  3608      "Options": {
  3609        "com.docker.network.bridge.default_bridge": "true",
  3610        "com.docker.network.bridge.enable_icc": "true",
  3611        "com.docker.network.bridge.enable_ip_masquerade": "true",
  3612        "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
  3613        "com.docker.network.bridge.name": "docker0",
  3614        "com.docker.network.driver.mtu": "1500"
  3615      }
  3616    },
  3617    {
  3618      "Name": "none",
  3619      "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
  3620      "Created": "0001-01-01T00:00:00Z",
  3621      "Scope": "local",
  3622      "Driver": "null",
  3623      "EnableIPv6": false,
  3624      "Internal": false,
  3625      "IPAM": {
  3626        "Driver": "default",
  3627        "Config": []
  3628      },
  3629      "Containers": {},
  3630      "Options": {}
  3631    },
  3632    {
  3633      "Name": "host",
  3634      "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
  3635      "Created": "0001-01-01T00:00:00Z",
  3636      "Scope": "local",
  3637      "Driver": "host",
  3638      "EnableIPv6": false,
  3639      "Internal": false,
  3640      "IPAM": {
  3641        "Driver": "default",
  3642        "Config": []
  3643      },
  3644      "Containers": {},
  3645      "Options": {}
  3646    }
  3647  ]
  3648  ```
  3649  
  3650  **Query parameters**:
  3651  
  3652  - **filters** - JSON encoded network list filter. The filter value is one of:
  3653    -   `driver=<driver-name>` Matches a network's driver.
  3654    -   `id=<network-id>` Matches all or part of a network id.
  3655    -   `label=<key>` or `label=<key>=<value>` of a network label.
  3656    -   `name=<network-name>` Matches all or part of a network name.
  3657    -   `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
  3658  
  3659  **Status codes**:
  3660  
  3661  -   **200** - no error
  3662  -   **500** - server error
  3663  
  3664  ### Inspect network
  3665  
  3666  `GET /networks/<network-id>`
  3667  
  3668  **Example request**:
  3669  
  3670      GET /networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
  3671  
  3672  **Example response**:
  3673  
  3674  ```
  3675  HTTP/1.1 200 OK
  3676  Content-Type: application/json
  3677  
  3678  {
  3679    "Name": "net01",
  3680    "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
  3681    "Created": "2016-10-19T04:33:30.360899459Z",
  3682    "Scope": "local",
  3683    "Driver": "bridge",
  3684    "EnableIPv6": false,
  3685    "IPAM": {
  3686      "Driver": "default",
  3687      "Config": [
  3688        {
  3689          "Subnet": "172.19.0.0/16",
  3690          "Gateway": "172.19.0.1"
  3691        }
  3692      ],
  3693      "Options": {
  3694          "foo": "bar"
  3695      }
  3696    },
  3697    "Internal": false,
  3698    "Containers": {
  3699      "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
  3700        "Name": "test",
  3701        "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
  3702        "MacAddress": "02:42:ac:13:00:02",
  3703        "IPv4Address": "172.19.0.2/16",
  3704        "IPv6Address": ""
  3705      }
  3706    },
  3707    "Options": {
  3708      "com.docker.network.bridge.default_bridge": "true",
  3709      "com.docker.network.bridge.enable_icc": "true",
  3710      "com.docker.network.bridge.enable_ip_masquerade": "true",
  3711      "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
  3712      "com.docker.network.bridge.name": "docker0",
  3713      "com.docker.network.driver.mtu": "1500"
  3714    },
  3715    "Labels": {
  3716      "com.example.some-label": "some-value",
  3717      "com.example.some-other-label": "some-other-value"
  3718    }
  3719  }
  3720  ```
  3721  
  3722  **Status codes**:
  3723  
  3724  -   **200** - no error
  3725  -   **404** - network not found
  3726  
  3727  ### Create a network
  3728  
  3729  `POST /networks/create`
  3730  
  3731  Create a network
  3732  
  3733  **Example request**:
  3734  
  3735  ```
  3736  POST /networks/create HTTP/1.1
  3737  Content-Type: application/json
  3738  
  3739  {
  3740    "Name":"isolated_nw",
  3741    "CheckDuplicate":false,
  3742    "Driver":"bridge",
  3743    "EnableIPv6": true,
  3744    "IPAM":{
  3745      "Config":[
  3746        {
  3747          "Subnet":"172.20.0.0/16",
  3748          "IPRange":"172.20.10.0/24",
  3749          "Gateway":"172.20.10.11"
  3750        },
  3751        {
  3752          "Subnet":"2001:db8:abcd::/64",
  3753          "Gateway":"2001:db8:abcd::1011"
  3754        }
  3755      ],
  3756      "Options": {
  3757        "foo": "bar"
  3758      }
  3759    },
  3760    "Internal":true,
  3761    "Options": {
  3762      "com.docker.network.bridge.default_bridge": "true",
  3763      "com.docker.network.bridge.enable_icc": "true",
  3764      "com.docker.network.bridge.enable_ip_masquerade": "true",
  3765      "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
  3766      "com.docker.network.bridge.name": "docker0",
  3767      "com.docker.network.driver.mtu": "1500"
  3768    },
  3769    "Labels": {
  3770      "com.example.some-label": "some-value",
  3771      "com.example.some-other-label": "some-other-value"
  3772    }
  3773  }
  3774  ```
  3775  
  3776  **Example response**:
  3777  
  3778  ```
  3779  HTTP/1.1 201 Created
  3780  Content-Type: application/json
  3781  
  3782  {
  3783    "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
  3784    "Warning": ""
  3785  }
  3786  ```
  3787  
  3788  **Status codes**:
  3789  
  3790  - **201** - no error
  3791  - **404** - plugin not found
  3792  - **500** - server error
  3793  
  3794  **JSON parameters**:
  3795  
  3796  - **Name** - The new network's name. this is a mandatory field
  3797  - **CheckDuplicate** - Requests daemon to check for networks with same name
  3798  - **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
  3799  - **Internal** - Restrict external access to the network
  3800  - **IPAM** - Optional custom IP scheme for the network
  3801  - **EnableIPv6** - Enable IPv6 on the network
  3802  - **Options** - Network specific options to be used by the drivers
  3803  - **Labels** - Labels to set on the network, specified as a map: `{"key":"value" [,"key2":"value2"]}`
  3804  
  3805  ### Connect a container to a network
  3806  
  3807  `POST /networks/(id)/connect`
  3808  
  3809  Connect a container to a network
  3810  
  3811  **Example request**:
  3812  
  3813  ```
  3814  POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
  3815  Content-Type: application/json
  3816  
  3817  {
  3818    "Container":"3613f73ba0e4",
  3819    "EndpointConfig": {
  3820      "IPAMConfig": {
  3821          "IPv4Address":"172.24.56.89",
  3822          "IPv6Address":"2001:db8::5689"
  3823      }
  3824    }
  3825  }
  3826  ```
  3827  
  3828  **Example response**:
  3829  
  3830      HTTP/1.1 200 OK
  3831  
  3832  **Status codes**:
  3833  
  3834  - **200** - no error
  3835  - **403** - operation not supported for swarm scoped networks
  3836  - **404** - network or container is not found
  3837  - **500** - Internal Server Error
  3838  
  3839  **JSON parameters**:
  3840  
  3841  - **container** - container-id/name to be connected to the network
  3842  
  3843  ### Disconnect a container from a network
  3844  
  3845  `POST /networks/(id)/disconnect`
  3846  
  3847  Disconnect a container from a network
  3848  
  3849  **Example request**:
  3850  
  3851  ```
  3852  POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
  3853  Content-Type: application/json
  3854  
  3855  {
  3856    "Container":"3613f73ba0e4",
  3857    "Force":false
  3858  }
  3859  ```
  3860  
  3861  **Example response**:
  3862  
  3863      HTTP/1.1 200 OK
  3864  
  3865  **Status codes**:
  3866  
  3867  - **200** - no error
  3868  - **403** - operation not supported for swarm scoped networks
  3869  - **404** - network or container not found
  3870  - **500** - Internal Server Error
  3871  
  3872  **JSON parameters**:
  3873  
  3874  - **Container** - container-id/name to be disconnected from a network
  3875  - **Force** - Force the container to disconnect from a network
  3876  
  3877  ### Remove a network
  3878  
  3879  `DELETE /networks/(id)`
  3880  
  3881  Instruct the driver to remove the network (`id`).
  3882  
  3883  **Example request**:
  3884  
  3885      DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
  3886  
  3887  **Example response**:
  3888  
  3889      HTTP/1.1 204 No Content
  3890  
  3891  **Status codes**:
  3892  
  3893  -   **204** - no error
  3894  -   **404** - no such network
  3895  -   **500** - server error
  3896  
  3897  ### Prune unused networks
  3898  
  3899  `POST /networks/prune`
  3900  
  3901  Delete unused networks
  3902  
  3903  **Example request**:
  3904  
  3905      POST /networks/prune HTTP/1.1
  3906      Content-Type: application/json
  3907  
  3908      {
  3909      }
  3910  
  3911  **Example response**:
  3912  
  3913      HTTP/1.1 200 OK
  3914      Content-Type: application/json
  3915  
  3916      {
  3917          "NetworksDeleted": [
  3918              "n1"
  3919          ],
  3920      }
  3921  
  3922  **Status codes**:
  3923  
  3924  -   **200** – no error
  3925  -   **500** – server error
  3926  
  3927  ## 3.6 Plugins
  3928  
  3929  ### List plugins
  3930  
  3931  `GET /plugins`
  3932  
  3933  Returns information about installed plugins.
  3934  
  3935  **Example request**:
  3936  
  3937      GET /plugins HTTP/1.1
  3938  
  3939  **Example response**:
  3940  
  3941  ```
  3942  HTTP/1.1 200 OK
  3943  Content-Type: application/json
  3944  
  3945  [
  3946    {
  3947      "Id": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078",
  3948      "Name": "tiborvass/no-remove",
  3949      "Tag": "latest",
  3950      "Active": true,
  3951      "Config": {
  3952        "Mounts": [
  3953          {
  3954            "Name": "",
  3955            "Description": "",
  3956            "Settable": null,
  3957            "Source": "/data",
  3958            "Destination": "/data",
  3959            "Type": "bind",
  3960            "Options": [
  3961              "shared",
  3962              "rbind"
  3963            ]
  3964          },
  3965          {
  3966            "Name": "",
  3967            "Description": "",
  3968            "Settable": null,
  3969            "Source": null,
  3970            "Destination": "/foobar",
  3971            "Type": "tmpfs",
  3972            "Options": null
  3973          }
  3974        ],
  3975        "Env": [
  3976          "DEBUG=1"
  3977        ],
  3978        "Args": null,
  3979        "Devices": null
  3980      },
  3981      "Manifest": {
  3982        "ManifestVersion": "v0",
  3983        "Description": "A test plugin for Docker",
  3984        "Documentation": "https://docs.docker.com/engine/extend/plugins/",
  3985        "Interface": {
  3986          "Types": [
  3987            "docker.volumedriver/1.0"
  3988          ],
  3989          "Socket": "plugins.sock"
  3990        },
  3991        "Entrypoint": [
  3992          "plugin-no-remove",
  3993          "/data"
  3994        ],
  3995        "Workdir": "",
  3996        "User": {
  3997        },
  3998        "Network": {
  3999          "Type": "host"
  4000        },
  4001        "Capabilities": null,
  4002        "Mounts": [
  4003          {
  4004            "Name": "",
  4005            "Description": "",
  4006            "Settable": null,
  4007            "Source": "/data",
  4008            "Destination": "/data",
  4009            "Type": "bind",
  4010            "Options": [
  4011              "shared",
  4012              "rbind"
  4013            ]
  4014          },
  4015          {
  4016            "Name": "",
  4017            "Description": "",
  4018            "Settable": null,
  4019            "Source": null,
  4020            "Destination": "/foobar",
  4021            "Type": "tmpfs",
  4022            "Options": null
  4023          }
  4024        ],
  4025        "Devices": [
  4026          {
  4027            "Name": "device",
  4028            "Description": "a host device to mount",
  4029            "Settable": null,
  4030            "Path": "/dev/cpu_dma_latency"
  4031          }
  4032        ],
  4033        "Env": [
  4034          {
  4035            "Name": "DEBUG",
  4036            "Description": "If set, prints debug messages",
  4037            "Settable": null,
  4038            "Value": "1"
  4039          }
  4040        ],
  4041        "Args": {
  4042          "Name": "args",
  4043          "Description": "command line arguments",
  4044          "Settable": null,
  4045          "Value": [
  4046  
  4047          ]
  4048        }
  4049      }
  4050    }
  4051  ]
  4052  ```
  4053  
  4054  **Status codes**:
  4055  
  4056  -   **200** - no error
  4057  -   **500** - server error
  4058  
  4059  ### Install a plugin
  4060  
  4061  `POST /plugins/pull?name=<plugin name>`
  4062  
  4063  Pulls and installs a plugin. After the plugin is installed, it can be enabled
  4064  using the [`POST /plugins/(plugin name)/enable` endpoint](#enable-a-plugin).
  4065  
  4066  **Example request**:
  4067  
  4068  ```
  4069  POST /plugins/pull?name=tiborvass/no-remove:latest HTTP/1.1
  4070  ```
  4071  
  4072  The `:latest` tag is optional, and is used as default if omitted. When using
  4073  this endpoint to pull a plugin from the registry, the `X-Registry-Auth` header
  4074  can be used to include a base64-encoded AuthConfig object. Refer to the [create
  4075  an image](#create-an-image) section for more details.
  4076  
  4077  **Example response**:
  4078  
  4079  ```
  4080  HTTP/1.1 200 OK
  4081  Content-Type: application/json
  4082  Content-Length: 175
  4083  
  4084  [
  4085    {
  4086      "Name": "network",
  4087      "Description": "",
  4088      "Value": [
  4089        "host"
  4090      ]
  4091    },
  4092    {
  4093      "Name": "mount",
  4094      "Description": "",
  4095      "Value": [
  4096        "/data"
  4097      ]
  4098    },
  4099    {
  4100      "Name": "device",
  4101      "Description": "",
  4102      "Value": [
  4103        "/dev/cpu_dma_latency"
  4104      ]
  4105    }
  4106  ]
  4107  ```
  4108  
  4109  **Query parameters**:
  4110  
  4111  - **name** -  Name of the plugin to pull. The name may include a tag or digest.
  4112      This parameter is required.
  4113  
  4114  **Status codes**:
  4115  
  4116  -   **200** - no error
  4117  -   **500** - error parsing reference / not a valid repository/tag: repository
  4118        name must have at least one component
  4119  -   **500** - plugin already exists
  4120  
  4121  ### Inspect a plugin
  4122  
  4123  `GET /plugins/(plugin name)`
  4124  
  4125  Returns detailed information about an installed plugin.
  4126  
  4127  **Example request**:
  4128  
  4129  ```
  4130  GET /plugins/tiborvass/no-remove:latest HTTP/1.1
  4131  ```
  4132  
  4133  The `:latest` tag is optional, and is used as default if omitted.
  4134  
  4135  
  4136  **Example response**:
  4137  
  4138  ```
  4139  HTTP/1.1 200 OK
  4140  Content-Type: application/json
  4141  
  4142  {
  4143    "Id": "5724e2c8652da337ab2eedd19fc6fc0ec908e4bd907c7421bf6a8dfc70c4c078",
  4144    "Name": "tiborvass/no-remove",
  4145    "Tag": "latest",
  4146    "Active": false,
  4147    "Config": {
  4148      "Mounts": [
  4149        {
  4150          "Name": "",
  4151          "Description": "",
  4152          "Settable": null,
  4153          "Source": "/data",
  4154          "Destination": "/data",
  4155          "Type": "bind",
  4156          "Options": [
  4157            "shared",
  4158            "rbind"
  4159          ]
  4160        },
  4161        {
  4162          "Name": "",
  4163          "Description": "",
  4164          "Settable": null,
  4165          "Source": null,
  4166          "Destination": "/foobar",
  4167          "Type": "tmpfs",
  4168          "Options": null
  4169        }
  4170      ],
  4171      "Env": [
  4172        "DEBUG=1"
  4173      ],
  4174      "Args": null,
  4175      "Devices": null
  4176    },
  4177    "Manifest": {
  4178      "ManifestVersion": "v0",
  4179      "Description": "A test plugin for Docker",
  4180      "Documentation": "https://docs.docker.com/engine/extend/plugins/",
  4181      "Interface": {
  4182        "Types": [
  4183          "docker.volumedriver/1.0"
  4184        ],
  4185        "Socket": "plugins.sock"
  4186      },
  4187      "Entrypoint": [
  4188        "plugin-no-remove",
  4189        "/data"
  4190      ],
  4191      "Workdir": "",
  4192      "User": {
  4193      },
  4194      "Network": {
  4195        "Type": "host"
  4196      },
  4197      "Capabilities": null,
  4198      "Mounts": [
  4199        {
  4200          "Name": "",
  4201          "Description": "",
  4202          "Settable": null,
  4203          "Source": "/data",
  4204          "Destination": "/data",
  4205          "Type": "bind",
  4206          "Options": [
  4207            "shared",
  4208            "rbind"
  4209          ]
  4210        },
  4211        {
  4212          "Name": "",
  4213          "Description": "",
  4214          "Settable": null,
  4215          "Source": null,
  4216          "Destination": "/foobar",
  4217          "Type": "tmpfs",
  4218          "Options": null
  4219        }
  4220      ],
  4221      "Devices": [
  4222        {
  4223          "Name": "device",
  4224          "Description": "a host device to mount",
  4225          "Settable": null,
  4226          "Path": "/dev/cpu_dma_latency"
  4227        }
  4228      ],
  4229      "Env": [
  4230        {
  4231          "Name": "DEBUG",
  4232          "Description": "If set, prints debug messages",
  4233          "Settable": null,
  4234          "Value": "1"
  4235        }
  4236      ],
  4237      "Args": {
  4238        "Name": "args",
  4239        "Description": "command line arguments",
  4240        "Settable": null,
  4241        "Value": [
  4242  
  4243        ]
  4244      }
  4245    }
  4246  }
  4247  ```
  4248  
  4249  **Status codes**:
  4250  
  4251  -   **200** - no error
  4252  -   **404** - plugin not installed
  4253  
  4254  <!-- TODO Document "docker plugin set" endpoint once implemented
  4255  ### Configure a plugin
  4256  
  4257  `POST /plugins/(plugin name)/set`
  4258  
  4259  **Status codes**:
  4260  
  4261  -   **500** - not implemented
  4262  
  4263  -->
  4264  
  4265  ### Enable a plugin
  4266  
  4267  `POST /plugins/(plugin name)/enable`
  4268  
  4269  Enables a plugin
  4270  
  4271  **Example request**:
  4272  
  4273  ```
  4274  POST /plugins/tiborvass/no-remove:latest/enable HTTP/1.1
  4275  ```
  4276  
  4277  The `:latest` tag is optional, and is used as default if omitted.
  4278  
  4279  
  4280  **Example response**:
  4281  
  4282  ```
  4283  HTTP/1.1 200 OK
  4284  Content-Length: 0
  4285  Content-Type: text/plain; charset=utf-8
  4286  ```
  4287  
  4288  **Status codes**:
  4289  
  4290  -   **200** - no error
  4291  -   **500** - plugin is already enabled
  4292  
  4293  ### Disable a plugin
  4294  
  4295  `POST /plugins/(plugin name)/disable`
  4296  
  4297  Disables a plugin
  4298  
  4299  **Example request**:
  4300  
  4301  ```
  4302  POST /plugins/tiborvass/no-remove:latest/disable HTTP/1.1
  4303  ```
  4304  
  4305  The `:latest` tag is optional, and is used as default if omitted.
  4306  
  4307  
  4308  **Example response**:
  4309  
  4310  ```
  4311  HTTP/1.1 200 OK
  4312  Content-Length: 0
  4313  Content-Type: text/plain; charset=utf-8
  4314  ```
  4315  
  4316  **Status codes**:
  4317  
  4318  -   **200** - no error
  4319  -   **500** - plugin is already disabled
  4320  
  4321  ### Remove a plugin
  4322  
  4323  `DELETE /plugins/(plugin name)`
  4324  
  4325  Removes a plugin
  4326  
  4327  **Example request**:
  4328  
  4329  ```
  4330  DELETE /plugins/tiborvass/no-remove:latest HTTP/1.1
  4331  ```
  4332  
  4333  The `:latest` tag is optional, and is used as default if omitted.
  4334  
  4335  **Example response**:
  4336  
  4337  ```
  4338  HTTP/1.1 200 OK
  4339  Content-Length: 0
  4340  Content-Type: text/plain; charset=utf-8
  4341  ```
  4342  
  4343  **Query parameters**:
  4344  
  4345  - **force** - Boolean value, set to `1` / `True` / `true` to force removing the
  4346      plugin. Forcing removal disables the plugin before removing, but may result
  4347      in issues if the plugin is in use by a container.
  4348  
  4349  **Status codes**:
  4350  
  4351  -   **200** - no error
  4352  -   **404** - plugin not installed
  4353  -   **500** - plugin is active
  4354  
  4355  <!-- TODO Document "docker plugin push" endpoint once we have "plugin build"
  4356  
  4357  ### Push a plugin
  4358  
  4359  `POST /plugins/tiborvass/(plugin name)/push HTTP/1.1`
  4360  
  4361  Pushes a plugin to the registry.
  4362  
  4363  **Example request**:
  4364  
  4365  ```
  4366  POST /plugins/tiborvass/no-remove:latest HTTP/1.1
  4367  ```
  4368  
  4369  The `:latest` tag is optional, and is used as default if omitted. When using
  4370  this endpoint to push a plugin to the registry, the `X-Registry-Auth` header
  4371  can be used to include a base64-encoded AuthConfig object. Refer to the [create
  4372  an image](#create-an-image) section for more details.
  4373  
  4374  **Example response**:
  4375  
  4376  **Status codes**:
  4377  
  4378  -   **200** - no error
  4379  -   **404** - plugin not installed
  4380  
  4381  -->
  4382  
  4383  ## 3.7 Nodes
  4384  
  4385  **Note**: Node operations require the engine to be part of a swarm.
  4386  
  4387  ### List nodes
  4388  
  4389  
  4390  `GET /nodes`
  4391  
  4392  List nodes
  4393  
  4394  **Example request**:
  4395  
  4396      GET /nodes HTTP/1.1
  4397  
  4398  **Example response**:
  4399  
  4400      HTTP/1.1 200 OK
  4401      Content-Type: application/json
  4402  
  4403      [
  4404        {
  4405          "ID": "24ifsmvkjbyhk",
  4406          "Version": {
  4407            "Index": 8
  4408          },
  4409          "CreatedAt": "2016-06-07T20:31:11.853781916Z",
  4410          "UpdatedAt": "2016-06-07T20:31:11.999868824Z",
  4411          "Spec": {
  4412            "Name": "my-node",
  4413            "Role": "manager",
  4414            "Availability": "active"
  4415            "Labels": {
  4416                "foo": "bar"
  4417            }
  4418          },
  4419          "Description": {
  4420            "Hostname": "bf3067039e47",
  4421            "Platform": {
  4422              "Architecture": "x86_64",
  4423              "OS": "linux"
  4424            },
  4425            "Resources": {
  4426              "NanoCPUs": 4000000000,
  4427              "MemoryBytes": 8272408576
  4428            },
  4429            "Engine": {
  4430              "EngineVersion": "1.12.0-dev",
  4431              "Labels": {
  4432                  "foo": "bar",
  4433              }
  4434              "Plugins": [
  4435                {
  4436                  "Type": "Volume",
  4437                  "Name": "local"
  4438                },
  4439                {
  4440                  "Type": "Network",
  4441                  "Name": "bridge"
  4442                }
  4443                {
  4444                  "Type": "Network",
  4445                  "Name": "null"
  4446                }
  4447                {
  4448                  "Type": "Network",
  4449                  "Name": "overlay"
  4450                }
  4451              ]
  4452            }
  4453          },
  4454          "Status": {
  4455            "State": "ready"
  4456          },
  4457          "ManagerStatus": {
  4458            "Leader": true,
  4459            "Reachability": "reachable",
  4460            "Addr": "172.17.0.2:2377""
  4461          }
  4462        }
  4463      ]
  4464  
  4465  **Query parameters**:
  4466  
  4467  - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
  4468    nodes list. Available filters:
  4469    - `id=<node id>`
  4470    - `name=<node name>`
  4471    - `membership=`(`pending`|`accepted`|`rejected`)`
  4472    - `role=`(`worker`|`manager`)`
  4473  
  4474  **Status codes**:
  4475  
  4476  - **200** – no error
  4477  - **500** – server error
  4478  
  4479  ### Inspect a node
  4480  
  4481  
  4482  `GET /nodes/<id>`
  4483  
  4484  Return low-level information on the node `id`
  4485  
  4486  **Example request**:
  4487  
  4488        GET /nodes/24ifsmvkjbyhk HTTP/1.1
  4489  
  4490  **Example response**:
  4491  
  4492      HTTP/1.1 200 OK
  4493      Content-Type: application/json
  4494  
  4495      {
  4496        "ID": "24ifsmvkjbyhk",
  4497        "Version": {
  4498          "Index": 8
  4499        },
  4500        "CreatedAt": "2016-06-07T20:31:11.853781916Z",
  4501        "UpdatedAt": "2016-06-07T20:31:11.999868824Z",
  4502        "Spec": {
  4503          "Name": "my-node",
  4504          "Role": "manager",
  4505          "Availability": "active"
  4506          "Labels": {
  4507              "foo": "bar"
  4508          }
  4509        },
  4510        "Description": {
  4511          "Hostname": "bf3067039e47",
  4512          "Platform": {
  4513            "Architecture": "x86_64",
  4514            "OS": "linux"
  4515          },
  4516          "Resources": {
  4517            "NanoCPUs": 4000000000,
  4518            "MemoryBytes": 8272408576
  4519          },
  4520          "Engine": {
  4521            "EngineVersion": "1.12.0-dev",
  4522            "Labels": {
  4523                "foo": "bar",
  4524            }
  4525            "Plugins": [
  4526              {
  4527                "Type": "Volume",
  4528                "Name": "local"
  4529              },
  4530              {
  4531                "Type": "Network",
  4532                "Name": "bridge"
  4533              }
  4534              {
  4535                "Type": "Network",
  4536                "Name": "null"
  4537              }
  4538              {
  4539                "Type": "Network",
  4540                "Name": "overlay"
  4541              }
  4542            ]
  4543          }
  4544        },
  4545        "Status": {
  4546          "State": "ready"
  4547        },
  4548        "ManagerStatus": {
  4549          "Leader": true,
  4550          "Reachability": "reachable",
  4551          "Addr": "172.17.0.2:2377""
  4552        }
  4553      }
  4554  
  4555  **Status codes**:
  4556  
  4557  -   **200** – no error
  4558  -   **404** – no such node
  4559  -   **500** – server error
  4560  
  4561  ### Remove a node
  4562  
  4563  
  4564  `DELETE /nodes/(id)`
  4565  
  4566  Remove a node [`id`] from the swarm.
  4567  
  4568  **Example request**:
  4569  
  4570      DELETE /nodes/24ifsmvkjbyhk HTTP/1.1
  4571  
  4572  **Example response**:
  4573  
  4574      HTTP/1.1 200 OK
  4575      Content-Length: 0
  4576      Content-Type: text/plain; charset=utf-8
  4577  
  4578  **Query parameters**:
  4579  
  4580  -   **force** - 1/True/true or 0/False/false, Force remove an active node.
  4581          Default `false`.
  4582  
  4583  **Status codes**:
  4584  
  4585  -   **200** – no error
  4586  -   **404** – no such node
  4587  -   **500** – server error
  4588  
  4589  ### Update a node
  4590  
  4591  
  4592  `POST /nodes/(id)/update`
  4593  
  4594  Update the node `id`.
  4595  
  4596  The payload of the `POST` request is the new `NodeSpec` and
  4597  overrides the current `NodeSpec` for the specified node.
  4598  
  4599  If `Availability` or `Role` are omitted, this returns an
  4600  error. Any other field omitted resets the current value to either
  4601  an empty value or the default cluster-wide value.
  4602  
  4603  **Example Request**
  4604  
  4605      POST /nodes/24ifsmvkjbyhk/update?version=8 HTTP/1.1
  4606      Content-Type: application/json
  4607  
  4608      {
  4609        "Availability": "active",
  4610        "Name": "node-name",
  4611        "Role": "manager",
  4612        "Labels": {
  4613          "foo": "bar"
  4614        }
  4615      }
  4616  
  4617  **Example response**:
  4618  
  4619      HTTP/1.1 200 OK
  4620      Content-Length: 0
  4621      Content-Type: text/plain; charset=utf-8
  4622  
  4623  **Query parameters**:
  4624  
  4625  - **version** – The version number of the node object being updated. This is
  4626    required to avoid conflicting writes.
  4627  
  4628  JSON Parameters:
  4629  
  4630  - **Annotations** – Optional medata to associate with the service.
  4631      - **Name** – User-defined name for the service.
  4632      - **Labels** – A map of labels to associate with the service (e.g.,
  4633        `{"key":"value", "key2":"value2"}`).
  4634  - **Role** - Role of the node (worker/manager).
  4635  - **Availability** - Availability of the node (active/pause/drain).
  4636  
  4637  
  4638  **Status codes**:
  4639  
  4640  -   **200** – no error
  4641  -   **404** – no such node
  4642  -   **500** – server error
  4643  
  4644  ## 3.8 Swarm
  4645  
  4646  ### Inspect swarm
  4647  
  4648  
  4649  `GET /swarm`
  4650  
  4651  Inspect swarm
  4652  
  4653  **Example response**:
  4654  
  4655      HTTP/1.1 200 OK
  4656      Content-Type: application/json
  4657  
  4658      {
  4659        "CreatedAt" : "2016-08-15T16:00:20.349727406Z",
  4660        "Spec" : {
  4661          "Dispatcher" : {
  4662            "HeartbeatPeriod" : 5000000000
  4663          },
  4664          "Orchestration" : {
  4665           "TaskHistoryRetentionLimit" : 10
  4666          },
  4667          "CAConfig" : {
  4668            "NodeCertExpiry" : 7776000000000000
  4669          },
  4670          "Raft" : {
  4671            "LogEntriesForSlowFollowers" : 500,
  4672            "HeartbeatTick" : 1,
  4673            "SnapshotInterval" : 10000,
  4674            "ElectionTick" : 3
  4675          },
  4676          "TaskDefaults" : {},
  4677          "Name" : "default"
  4678        },
  4679       "JoinTokens" : {
  4680          "Worker" : "SWMTKN-1-1h8aps2yszaiqmz2l3oc5392pgk8e49qhx2aj3nyv0ui0hez2a-6qmn92w6bu3jdvnglku58u11a",
  4681          "Manager" : "SWMTKN-1-1h8aps2yszaiqmz2l3oc5392pgk8e49qhx2aj3nyv0ui0hez2a-8llk83c4wm9lwioey2s316r9l"
  4682       },
  4683       "ID" : "70ilmkj2f6sp2137c753w2nmt",
  4684       "UpdatedAt" : "2016-08-15T16:32:09.623207604Z",
  4685       "Version" : {
  4686         "Index" : 51
  4687      }
  4688    }
  4689  
  4690  **Status codes**:
  4691  
  4692  - **200** - no error
  4693  
  4694  ### Initialize a new swarm
  4695  
  4696  
  4697  `POST /swarm/init`
  4698  
  4699  Initialize a new swarm. The body of the HTTP response includes the node ID.
  4700  
  4701  **Example request**:
  4702  
  4703      POST /swarm/init HTTP/1.1
  4704      Content-Type: application/json
  4705  
  4706      {
  4707        "ListenAddr": "0.0.0.0:2377",
  4708        "AdvertiseAddr": "192.168.1.1:2377",
  4709        "ForceNewCluster": false,
  4710        "Spec": {
  4711          "Orchestration": {},
  4712          "Raft": {},
  4713          "Dispatcher": {},
  4714          "CAConfig": {}
  4715        }
  4716      }
  4717  
  4718  **Example response**:
  4719  
  4720      HTTP/1.1 200 OK
  4721      Content-Length: 28
  4722      Content-Type: application/json
  4723      Date: Thu, 01 Sep 2016 21:49:13 GMT
  4724      Server: Docker/1.12.0 (linux)
  4725  
  4726      "7v2t30z9blmxuhnyo6s4cpenp"
  4727  
  4728  **Status codes**:
  4729  
  4730  - **200** – no error
  4731  - **400** – bad parameter
  4732  - **406** – node is already part of a swarm
  4733  
  4734  JSON Parameters:
  4735  
  4736  - **ListenAddr** – Listen address used for inter-manager communication, as well as determining
  4737    the networking interface used for the VXLAN Tunnel Endpoint (VTEP). This can either be an
  4738    address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
  4739    number, like `eth0:4567`. If the port number is omitted, the default swarm listening port is
  4740    used.
  4741  - **AdvertiseAddr** – Externally reachable address advertised to other nodes. This can either be
  4742    an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
  4743    number, like `eth0:4567`. If the port number is omitted, the port number from the listen
  4744    address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when
  4745    possible.
  4746  - **ForceNewCluster** – Force creation of a new swarm.
  4747  - **Spec** – Configuration settings for the new swarm.
  4748      - **Orchestration** – Configuration settings for the orchestration aspects of the swarm.
  4749          - **TaskHistoryRetentionLimit** – Maximum number of tasks history stored.
  4750      - **Raft** – Raft related configuration.
  4751          - **SnapshotInterval** – Number of logs entries between snapshot.
  4752          - **KeepOldSnapshots** – Number of snapshots to keep beyond the current snapshot.
  4753          - **LogEntriesForSlowFollowers** – Number of log entries to keep around to sync up slow
  4754            followers after a snapshot is created.
  4755          - **HeartbeatTick** – Amount of ticks (in seconds) between each heartbeat.
  4756          - **ElectionTick** – Amount of ticks (in seconds) needed without a leader to trigger a new
  4757            election.
  4758      - **Dispatcher** – Configuration settings for the task dispatcher.
  4759          - **HeartbeatPeriod** – The delay for an agent to send a heartbeat to the dispatcher.
  4760      - **CAConfig** – Certificate authority configuration.
  4761          - **NodeCertExpiry** – Automatic expiry for nodes certificates.
  4762          - **ExternalCA** - Configuration for forwarding signing requests to an external
  4763            certificate authority.
  4764              - **Protocol** - Protocol for communication with the external CA
  4765                (currently only "cfssl" is supported).
  4766              - **URL** - URL where certificate signing requests should be sent.
  4767              - **Options** - An object with key/value pairs that are interpreted
  4768                as protocol-specific options for the external CA driver.
  4769  
  4770  ### Join an existing swarm
  4771  
  4772  `POST /swarm/join`
  4773  
  4774  Join an existing swarm
  4775  
  4776  **Example request**:
  4777  
  4778      POST /swarm/join HTTP/1.1
  4779      Content-Type: application/json
  4780  
  4781      {
  4782        "ListenAddr": "0.0.0.0:2377",
  4783        "AdvertiseAddr": "192.168.1.1:2377",
  4784        "RemoteAddrs": ["node1:2377"],
  4785        "JoinToken": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2"
  4786      }
  4787  
  4788  **Example response**:
  4789  
  4790      HTTP/1.1 200 OK
  4791      Content-Length: 0
  4792      Content-Type: text/plain; charset=utf-8
  4793  
  4794  **Status codes**:
  4795  
  4796  - **200** – no error
  4797  - **400** – bad parameter
  4798  - **406** – node is already part of a swarm
  4799  
  4800  JSON Parameters:
  4801  
  4802  - **ListenAddr** – Listen address used for inter-manager communication if the node gets promoted to
  4803    manager, as well as determining the networking interface used for the VXLAN Tunnel Endpoint (VTEP).
  4804  - **AdvertiseAddr** – Externally reachable address advertised to other nodes. This can either be
  4805    an address/port combination in the form `192.168.1.1:4567`, or an interface followed by a port
  4806    number, like `eth0:4567`. If the port number is omitted, the port number from the listen
  4807    address is used. If `AdvertiseAddr` is not specified, it will be automatically detected when
  4808    possible.
  4809  - **RemoteAddr** – Address of any manager node already participating in the swarm.
  4810  - **JoinToken** – Secret token for joining this swarm.
  4811  
  4812  ### Leave a swarm
  4813  
  4814  
  4815  `POST /swarm/leave`
  4816  
  4817  Leave a swarm
  4818  
  4819  **Example request**:
  4820  
  4821      POST /swarm/leave HTTP/1.1
  4822  
  4823  **Example response**:
  4824  
  4825      HTTP/1.1 200 OK
  4826      Content-Length: 0
  4827      Content-Type: text/plain; charset=utf-8
  4828  
  4829  **Query parameters**:
  4830  
  4831  - **force** - Boolean (0/1, false/true). Force leave swarm, even if this is the last manager or that it will break the cluster.
  4832  
  4833  **Status codes**:
  4834  
  4835  - **200** – no error
  4836  - **406** – node is not part of a swarm
  4837  
  4838  ### Update a swarm
  4839  
  4840  
  4841  `POST /swarm/update`
  4842  
  4843  Update a swarm
  4844  
  4845  **Example request**:
  4846  
  4847      POST /swarm/update HTTP/1.1
  4848  
  4849      {
  4850        "Name": "default",
  4851        "Orchestration": {
  4852          "TaskHistoryRetentionLimit": 10
  4853        },
  4854        "Raft": {
  4855          "SnapshotInterval": 10000,
  4856          "LogEntriesForSlowFollowers": 500,
  4857          "HeartbeatTick": 1,
  4858          "ElectionTick": 3
  4859        },
  4860        "Dispatcher": {
  4861          "HeartbeatPeriod": 5000000000
  4862        },
  4863        "CAConfig": {
  4864          "NodeCertExpiry": 7776000000000000
  4865        },
  4866        "JoinTokens": {
  4867          "Worker": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx",
  4868          "Manager": "SWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-7p73s1dx5in4tatdymyhg9hu2"
  4869        }
  4870      }
  4871  
  4872  
  4873  **Example response**:
  4874  
  4875      HTTP/1.1 200 OK
  4876      Content-Length: 0
  4877      Content-Type: text/plain; charset=utf-8
  4878  
  4879  **Query parameters**:
  4880  
  4881  - **version** – The version number of the swarm object being updated. This is
  4882    required to avoid conflicting writes.
  4883  - **rotateWorkerToken** - Set to `true` (or `1`) to rotate the worker join token.
  4884  - **rotateManagerToken** - Set to `true` (or `1`) to rotate the manager join token.
  4885  
  4886  **Status codes**:
  4887  
  4888  - **200** – no error
  4889  - **400** – bad parameter
  4890  - **406** – node is not part of a swarm
  4891  
  4892  JSON Parameters:
  4893  
  4894  - **Orchestration** – Configuration settings for the orchestration aspects of the swarm.
  4895      - **TaskHistoryRetentionLimit** – Maximum number of tasks history stored.
  4896  - **Raft** – Raft related configuration.
  4897      - **SnapshotInterval** – Number of logs entries between snapshot.
  4898      - **KeepOldSnapshots** – Number of snapshots to keep beyond the current snapshot.
  4899      - **LogEntriesForSlowFollowers** – Number of log entries to keep around to sync up slow
  4900        followers after a snapshot is created.
  4901      - **HeartbeatTick** – Amount of ticks (in seconds) between each heartbeat.
  4902      - **ElectionTick** – Amount of ticks (in seconds) needed without a leader to trigger a new
  4903        election.
  4904  - **Dispatcher** – Configuration settings for the task dispatcher.
  4905      - **HeartbeatPeriod** – The delay for an agent to send a heartbeat to the dispatcher.
  4906  - **CAConfig** – CA configuration.
  4907      - **NodeCertExpiry** – Automatic expiry for nodes certificates.
  4908      - **ExternalCA** - Configuration for forwarding signing requests to an external
  4909        certificate authority.
  4910          - **Protocol** - Protocol for communication with the external CA
  4911            (currently only "cfssl" is supported).
  4912          - **URL** - URL where certificate signing requests should be sent.
  4913          - **Options** - An object with key/value pairs that are interpreted
  4914            as protocol-specific options for the external CA driver.
  4915  - **JoinTokens** - Tokens that can be used by other nodes to join the swarm.
  4916      - **Worker** - Token to use for joining as a worker.
  4917      - **Manager** - Token to use for joining as a manager.
  4918  
  4919  ## 3.9 Services
  4920  
  4921  **Note**: Service operations require to first be part of a swarm.
  4922  
  4923  ### List services
  4924  
  4925  
  4926  `GET /services`
  4927  
  4928  List services
  4929  
  4930  **Example request**:
  4931  
  4932      GET /services HTTP/1.1
  4933  
  4934  **Example response**:
  4935  
  4936      HTTP/1.1 200 OK
  4937      Content-Type: application/json
  4938  
  4939      [
  4940        {
  4941          "ID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  4942          "Version": {
  4943            "Index": 19
  4944          },
  4945          "CreatedAt": "2016-06-07T21:05:51.880065305Z",
  4946          "UpdatedAt": "2016-06-07T21:07:29.962229872Z",
  4947          "Spec": {
  4948            "Name": "hopeful_cori",
  4949            "TaskTemplate": {
  4950              "ContainerSpec": {
  4951                "Image": "redis"
  4952              },
  4953              "Resources": {
  4954                "Limits": {},
  4955                "Reservations": {}
  4956              },
  4957              "RestartPolicy": {
  4958                "Condition": "any",
  4959                "MaxAttempts": 0
  4960              },
  4961              "Placement": {},
  4962              "ForceUpdate": 0
  4963            },
  4964            "Mode": {
  4965              "Replicated": {
  4966                "Replicas": 1
  4967              }
  4968            },
  4969            "UpdateConfig": {
  4970              "Parallelism": 1,
  4971              "FailureAction": "pause",
  4972              "Monitor": 15000000000,
  4973              "MaxFailureRatio": 0.15
  4974            },
  4975            "EndpointSpec": {
  4976              "Mode": "vip",
  4977              "Ports": [
  4978                {
  4979                  "Protocol": "tcp",
  4980                  "TargetPort": 6379,
  4981                  "PublishedPort": 30001
  4982                }
  4983              ]
  4984            }
  4985          },
  4986          "Endpoint": {
  4987            "Spec": {
  4988              "Mode": "vip",
  4989              "Ports": [
  4990                {
  4991                  "Protocol": "tcp",
  4992                  "TargetPort": 6379,
  4993                  "PublishedPort": 30001
  4994                }
  4995              ]
  4996            },
  4997            "Ports": [
  4998              {
  4999                "Protocol": "tcp",
  5000                "TargetPort": 6379,
  5001                "PublishedPort": 30001
  5002              }
  5003            ],
  5004            "VirtualIPs": [
  5005              {
  5006                "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
  5007                "Addr": "10.255.0.2/16"
  5008              },
  5009              {
  5010                "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
  5011                "Addr": "10.255.0.3/16"
  5012              }
  5013            ]
  5014          }
  5015        }
  5016      ]
  5017  
  5018  **Query parameters**:
  5019  
  5020  - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
  5021    services list. Available filters:
  5022    - `id=<node id>`
  5023    - `name=<node name>`
  5024  
  5025  **Status codes**:
  5026  
  5027  - **200** – no error
  5028  - **500** – server error
  5029  
  5030  ### Create a service
  5031  
  5032  `POST /services/create`
  5033  
  5034  Create a service. When using this endpoint to create a service using a private
  5035  repository from the registry, the `X-Registry-Auth` header must be used to
  5036  include a base64-encoded AuthConfig object. Refer to the [create an
  5037  image](#create-an-image) section for more details.
  5038  
  5039  **Example request**:
  5040  
  5041      POST /services/create HTTP/1.1
  5042      Content-Type: application/json
  5043  
  5044      {
  5045        "Name": "web",
  5046        "TaskTemplate": {
  5047          "ContainerSpec": {
  5048            "Image": "nginx:alpine",
  5049            "Mounts": [
  5050              {
  5051                "ReadOnly": true,
  5052                "Source": "web-data",
  5053                "Target": "/usr/share/nginx/html",
  5054                "Type": "volume",
  5055                "VolumeOptions": {
  5056                  "DriverConfig": {
  5057                  },
  5058                  "Labels": {
  5059                    "com.example.something": "something-value"
  5060                  }
  5061                }
  5062              }
  5063            ],
  5064            "User": "33"
  5065          },
  5066          "LogDriver": {
  5067            "Name": "json-file",
  5068            "Options": {
  5069              "max-file": "3",
  5070              "max-size": "10M"
  5071            }
  5072          },
  5073          "Placement": {},
  5074          "Resources": {
  5075            "Limits": {
  5076              "MemoryBytes": 104857600.0
  5077            },
  5078            "Reservations": {
  5079            }
  5080          },
  5081          "RestartPolicy": {
  5082            "Condition": "on-failure",
  5083            "Delay": 10000000000.0,
  5084            "MaxAttempts": 10
  5085          },
  5086          "ForceUpdate": 0
  5087        },
  5088        "Mode": {
  5089          "Replicated": {
  5090            "Replicas": 4
  5091          }
  5092        },
  5093        "UpdateConfig": {
  5094          "Delay": 30000000000.0,
  5095          "Parallelism": 2,
  5096          "FailureAction": "pause"
  5097        },
  5098        "EndpointSpec": {
  5099          "Ports": [
  5100            {
  5101              "Protocol": "tcp",
  5102              "PublishedPort": 8080,
  5103              "TargetPort": 80
  5104            }
  5105          ]
  5106        },
  5107        "Labels": {
  5108          "foo": "bar"
  5109        }
  5110      }
  5111  
  5112  **Example response**:
  5113  
  5114      HTTP/1.1 201 Created
  5115      Content-Type: application/json
  5116  
  5117      {
  5118        "ID":"ak7w3gjqoa3kuz8xcpnyy0pvl"
  5119      }
  5120  
  5121  **Status codes**:
  5122  
  5123  - **201** – no error
  5124  - **406** – server error or node is not part of a swarm
  5125  - **409** – name conflicts with an existing object
  5126  
  5127  **JSON Parameters**:
  5128  
  5129  - **Name** – User-defined name for the service.
  5130  - **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
  5131  - **TaskTemplate** – Specification of the tasks to start as part of the new service.
  5132      - **ContainerSpec** - Container settings for containers started as part of this task.
  5133          - **Image** – A string specifying the image name to use for the container.
  5134          - **Command** – The command to be run in the image.
  5135          - **Args** – Arguments to the command.
  5136          - **Env** – A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`.
  5137          - **Dir** – A string specifying the working directory for commands to run in.
  5138          - **User** – A string value specifying the user inside the container.
  5139          - **Labels** – A map of labels to associate with the service (e.g.,
  5140            `{"key":"value", "key2":"value2"}`).
  5141          - **Mounts** – Specification for mounts to be added to containers
  5142            created as part of the service.
  5143              - **Target** – Container path.
  5144              - **Source** – Mount source (e.g. a volume name, a host path).
  5145              - **Type** – The mount type (`bind`, or `volume`).
  5146              - **ReadOnly** – A boolean indicating whether the mount should be read-only.
  5147              - **BindOptions** - Optional configuration for the `bind` type.
  5148                - **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
  5149              - **VolumeOptions** – Optional configuration for the `volume` type.
  5150                  - **NoCopy** – A boolean indicating if volume should be
  5151                    populated with the data from the target. (Default false)
  5152                  - **Labels** – User-defined name and labels for the volume.
  5153                  - **DriverConfig** – Map of driver-specific options.
  5154                    - **Name** - Name of the driver to use to create the volume.
  5155                    - **Options** - key/value map of driver specific options.
  5156          - **StopGracePeriod** – Amount of time to wait for the container to terminate before
  5157            forcefully killing it.
  5158      - **LogDriver** - Log configuration for containers created as part of the
  5159        service.
  5160          - **Name** - Name of the logging driver to use (`json-file`, `syslog`,
  5161            `journald`, `gelf`, `fluentd`, `awslogs`, `splunk`, `etwlogs`, `none`).
  5162          - **Options** - Driver-specific options.
  5163      - **Resources** – Resource requirements which apply to each individual container created as part
  5164        of the service.
  5165          - **Limits** – Define resources limits.
  5166              - **NanoCPUs** – CPU limit in units of 10<sup>-9</sup> CPU shares.
  5167              - **MemoryBytes** – Memory limit in Bytes.
  5168          - **Reservation** – Define resources reservation.
  5169              - **NanoCPUs** – CPU reservation in units of 10<sup>-9</sup> CPU shares.
  5170              - **MemoryBytes** – Memory reservation in Bytes.
  5171      - **RestartPolicy** – Specification for the restart policy which applies to containers created
  5172        as part of this service.
  5173          - **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
  5174          - **Delay** – Delay between restart attempts, in nanoseconds.
  5175          - **MaxAttempts** – Maximum attempts to restart a given container before giving up (default value
  5176            is 0, which is ignored).
  5177          - **Window** – Windows is the time window used to evaluate the restart policy (default value is
  5178            0, which is unbounded).
  5179      - **Placement** – An array of constraints.
  5180      - **ForceUpdate**: A counter that triggers an update even if no relevant parameters have been changed.
  5181  - **Mode** – Scheduling mode for the service (`replicated` or `global`, defaults to `replicated`).
  5182  - **UpdateConfig** – Specification for the update strategy of the service.
  5183      - **Parallelism** – Maximum number of tasks to be updated in one iteration (0 means unlimited
  5184        parallelism).
  5185      - **Delay** – Amount of time between updates, in nanoseconds.
  5186      - **FailureAction** - Action to take if an updated task fails to run, or stops running during the
  5187        update. Values are `continue` and `pause`.
  5188      - **Monitor** - Amount of time to monitor each updated task for failures, in nanoseconds.
  5189      - **MaxFailureRatio** - The fraction of tasks that may fail during an update before the
  5190        failure action is invoked, specified as a floating point number between 0 and 1. The default is 0.
  5191  - **Networks** – Array of network names or IDs to attach the service to.
  5192  - **EndpointSpec** – Properties that can be configured to access and load balance a service.
  5193      - **Mode** – The mode of resolution to use for internal load balancing
  5194        between tasks (`vip` or `dnsrr`). Defaults to `vip` if not provided.
  5195      - **Ports** – List of exposed ports that this service is accessible on from
  5196        the outside, in the form of:
  5197        `{"Protocol": <"tcp"|"udp">, "PublishedPort": <port>, "TargetPort": <port>}`.
  5198        Ports can only be provided if `vip` resolution mode is used.
  5199  
  5200  **Request Headers**:
  5201  
  5202  - **Content-type** – Set to `"application/json"`.
  5203  - **X-Registry-Auth** – base64-encoded AuthConfig object, containing either
  5204    login information, or a token. Refer to the [create an image](#create-an-image)
  5205    section for more details.
  5206  
  5207  
  5208  ### Remove a service
  5209  
  5210  
  5211  `DELETE /services/(id or name)`
  5212  
  5213  Stop and remove the service `id`
  5214  
  5215  **Example request**:
  5216  
  5217      DELETE /services/16253994b7c4 HTTP/1.1
  5218  
  5219  **Example response**:
  5220  
  5221      HTTP/1.1 200 OK
  5222      Content-Length: 0
  5223      Content-Type: text/plain; charset=utf-8
  5224  
  5225  **Status codes**:
  5226  
  5227  -   **200** – no error
  5228  -   **404** – no such service
  5229  -   **500** – server error
  5230  
  5231  ### Inspect one or more services
  5232  
  5233  
  5234  `GET /services/(id or name)`
  5235  
  5236  Return information on the service `id`.
  5237  
  5238  **Example request**:
  5239  
  5240      GET /services/1cb4dnqcyx6m66g2t538x3rxha HTTP/1.1
  5241  
  5242  **Example response**:
  5243  
  5244      {
  5245        "ID": "ak7w3gjqoa3kuz8xcpnyy0pvl",
  5246        "Version": {
  5247          "Index": 95
  5248        },
  5249        "CreatedAt": "2016-06-07T21:10:20.269723157Z",
  5250        "UpdatedAt": "2016-06-07T21:10:20.276301259Z",
  5251        "Spec": {
  5252          "Name": "redis",
  5253          "TaskTemplate": {
  5254            "ContainerSpec": {
  5255              "Image": "redis"
  5256            },
  5257            "Resources": {
  5258              "Limits": {},
  5259              "Reservations": {}
  5260            },
  5261            "RestartPolicy": {
  5262              "Condition": "any",
  5263              "MaxAttempts": 0
  5264            },
  5265            "Placement": {}
  5266          },
  5267          "Mode": {
  5268            "Replicated": {
  5269              "Replicas": 1
  5270            }
  5271          },
  5272          "UpdateConfig": {
  5273            "Parallelism": 1,
  5274            "FailureAction": "pause"
  5275          },
  5276          "EndpointSpec": {
  5277            "Mode": "vip",
  5278            "Ports": [
  5279              {
  5280                "Protocol": "tcp",
  5281                "TargetPort": 6379,
  5282                "PublishedPort": 30001
  5283              }
  5284            ]
  5285          }
  5286        },
  5287        "Endpoint": {
  5288          "Spec": {
  5289            "Mode": "vip",
  5290            "Ports": [
  5291              {
  5292                "Protocol": "tcp",
  5293                "TargetPort": 6379,
  5294                "PublishedPort": 30001
  5295              }
  5296            ]
  5297          },
  5298          "Ports": [
  5299            {
  5300              "Protocol": "tcp",
  5301              "TargetPort": 6379,
  5302              "PublishedPort": 30001
  5303            }
  5304          ],
  5305          "VirtualIPs": [
  5306            {
  5307              "NetworkID": "4qvuz4ko70xaltuqbt8956gd1",
  5308              "Addr": "10.255.0.4/16"
  5309            }
  5310          ]
  5311        }
  5312      }
  5313  
  5314  **Status codes**:
  5315  
  5316  -   **200** – no error
  5317  -   **404** – no such service
  5318  -   **500** – server error
  5319  
  5320  ### Update a service
  5321  
  5322  `POST /services/(id or name)/update`
  5323  
  5324  Update a service. When using this endpoint to create a service using a
  5325  private repository from the registry, the `X-Registry-Auth` header can be used
  5326  to update the authentication information for that is stored for the service.
  5327  The header contains a base64-encoded AuthConfig object. Refer to the [create an
  5328  image](#create-an-image) section for more details.
  5329  
  5330  **Example request**:
  5331  
  5332      POST /services/1cb4dnqcyx6m66g2t538x3rxha/update?version=23 HTTP/1.1
  5333      Content-Type: application/json
  5334  
  5335      {
  5336        "Name": "top",
  5337        "TaskTemplate": {
  5338          "ContainerSpec": {
  5339            "Image": "busybox",
  5340            "Args": [
  5341              "top"
  5342            ]
  5343          },
  5344          "Resources": {
  5345            "Limits": {},
  5346            "Reservations": {}
  5347          },
  5348          "RestartPolicy": {
  5349            "Condition": "any",
  5350            "MaxAttempts": 0
  5351          },
  5352          "Placement": {},
  5353          "ForceUpdate": 0
  5354        },
  5355        "Mode": {
  5356          "Replicated": {
  5357            "Replicas": 1
  5358          }
  5359        },
  5360        "UpdateConfig": {
  5361          "Parallelism": 1,
  5362          "Monitor": 15000000000,
  5363          "MaxFailureRatio": 0.15
  5364        },
  5365        "EndpointSpec": {
  5366          "Mode": "vip"
  5367        }
  5368      }
  5369  
  5370  **Example response**:
  5371  
  5372      HTTP/1.1 200 OK
  5373      Content-Length: 0
  5374      Content-Type: text/plain; charset=utf-8
  5375  
  5376  **JSON Parameters**:
  5377  
  5378  - **Name** – User-defined name for the service.
  5379  - **Labels** – A map of labels to associate with the service (e.g., `{"key":"value", "key2":"value2"}`).
  5380  - **TaskTemplate** – Specification of the tasks to start as part of the new service.
  5381      - **ContainerSpec** - Container settings for containers started as part of this task.
  5382          - **Image** – A string specifying the image name to use for the container.
  5383          - **Command** – The command to be run in the image.
  5384          - **Args** – Arguments to the command.
  5385          - **Env** – A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`.
  5386          - **Dir** – A string specifying the working directory for commands to run in.
  5387          - **User** – A string value specifying the user inside the container.
  5388          - **Labels** – A map of labels to associate with the service (e.g.,
  5389            `{"key":"value", "key2":"value2"}`).
  5390          - **Mounts** – Specification for mounts to be added to containers created as part of the new
  5391            service.
  5392              - **Target** – Container path.
  5393              - **Source** – Mount source (e.g. a volume name, a host path).
  5394              - **Type** – The mount type (`bind`, or `volume`).
  5395              - **ReadOnly** – A boolean indicating whether the mount should be read-only.
  5396              - **BindOptions** - Optional configuration for the `bind` type
  5397                - **Propagation** – A propagation mode with the value `[r]private`, `[r]shared`, or `[r]slave`.
  5398              - **VolumeOptions** – Optional configuration for the `volume` type.
  5399                  - **NoCopy** – A boolean indicating if volume should be
  5400                    populated with the data from the target. (Default false)
  5401                  - **Labels** – User-defined name and labels for the volume.
  5402                  - **DriverConfig** – Map of driver-specific options.
  5403                    - **Name** - Name of the driver to use to create the volume
  5404                    - **Options** - key/value map of driver specific options
  5405          - **StopGracePeriod** – Amount of time to wait for the container to terminate before
  5406            forcefully killing it.
  5407      - **Resources** – Resource requirements which apply to each individual container created as part
  5408        of the service.
  5409          - **Limits** – Define resources limits.
  5410              - **CPU** – CPU limit
  5411              - **Memory** – Memory limit
  5412          - **Reservation** – Define resources reservation.
  5413              - **CPU** – CPU reservation
  5414              - **Memory** – Memory reservation
  5415      - **RestartPolicy** – Specification for the restart policy which applies to containers created
  5416        as part of this service.
  5417          - **Condition** – Condition for restart (`none`, `on-failure`, or `any`).
  5418          - **Delay** – Delay between restart attempts, in nanoseconds.
  5419          - **MaxAttempts** – Maximum attempts to restart a given container before giving up (default value
  5420            is 0, which is ignored).
  5421          - **Window** – Windows is the time window used to evaluate the restart policy (default value is
  5422            0, which is unbounded).
  5423      - **Placement** – An array of constraints.
  5424      - **ForceUpdate**: A counter that triggers an update even if no relevant parameters have been changed.
  5425  - **Mode** – Scheduling mode for the service (`replicated` or `global`, defaults to `replicated`).
  5426  - **UpdateConfig** – Specification for the update strategy of the service.
  5427      - **Parallelism** – Maximum number of tasks to be updated in one iteration (0 means unlimited
  5428        parallelism).
  5429      - **Delay** – Amount of time between updates, in nanoseconds.
  5430      - **FailureAction** - Action to take if an updated task fails to run, or stops running during the
  5431        update. Values are `continue` and `pause`.
  5432      - **Monitor** - Amount of time to monitor each updated task for failures, in nanoseconds.
  5433      - **MaxFailureRatio** - The fraction of tasks that may fail during an update before the
  5434        failure action is invoked, specified as a floating point number between 0 and 1. The default is 0.
  5435  - **Networks** – Array of network names or IDs to attach the service to.
  5436  - **EndpointSpec** – Properties that can be configured to access and load balance a service.
  5437      - **Mode** – The mode of resolution to use for internal load balancing
  5438        between tasks (`vip` or `dnsrr`). Defaults to `vip` if not provided.
  5439      - **Ports** – List of exposed ports that this service is accessible on from
  5440        the outside, in the form of:
  5441        `{"Protocol": <"tcp"|"udp">, "PublishedPort": <port>, "TargetPort": <port>}`.
  5442        Ports can only be provided if `vip` resolution mode is used.
  5443  
  5444  **Query parameters**:
  5445  
  5446  - **version** – The version number of the service object being updated. This is
  5447    required to avoid conflicting writes.
  5448  - **registryAuthFrom** - If the X-Registry-Auth header is not specified, this
  5449    parameter indicates where to find registry authorization credentials. The
  5450    valid values are `spec` and `previous-spec`. If unspecified, the default is
  5451    `spec`.
  5452  
  5453  **Request Headers**:
  5454  
  5455  - **Content-type** – Set to `"application/json"`.
  5456  - **X-Registry-Auth** – base64-encoded AuthConfig object, containing either
  5457    login information, or a token. Refer to the [create an image](#create-an-image)
  5458    section for more details.
  5459  
  5460  **Status codes**:
  5461  
  5462  -   **200** – no error
  5463  -   **404** – no such service
  5464  -   **500** – server error
  5465  
  5466  ## 3.10 Tasks
  5467  
  5468  **Note**: Task operations require the engine to be part of a swarm.
  5469  
  5470  ### List tasks
  5471  
  5472  
  5473  `GET /tasks`
  5474  
  5475  List tasks
  5476  
  5477  **Example request**:
  5478  
  5479      GET /tasks HTTP/1.1
  5480  
  5481  **Example response**:
  5482  
  5483      [
  5484        {
  5485          "ID": "0kzzo1i0y4jz6027t0k7aezc7",
  5486          "Version": {
  5487            "Index": 71
  5488          },
  5489          "CreatedAt": "2016-06-07T21:07:31.171892745Z",
  5490          "UpdatedAt": "2016-06-07T21:07:31.376370513Z",
  5491          "Spec": {
  5492            "ContainerSpec": {
  5493              "Image": "redis"
  5494            },
  5495            "Resources": {
  5496              "Limits": {},
  5497              "Reservations": {}
  5498            },
  5499            "RestartPolicy": {
  5500              "Condition": "any",
  5501              "MaxAttempts": 0
  5502            },
  5503            "Placement": {}
  5504          },
  5505          "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  5506          "Slot": 1,
  5507          "NodeID": "60gvrl6tm78dmak4yl7srz94v",
  5508          "Status": {
  5509            "Timestamp": "2016-06-07T21:07:31.290032978Z",
  5510            "State": "running",
  5511            "Message": "started",
  5512            "ContainerStatus": {
  5513              "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
  5514              "PID": 677
  5515            }
  5516          },
  5517          "DesiredState": "running",
  5518          "NetworksAttachments": [
  5519            {
  5520              "Network": {
  5521                "ID": "4qvuz4ko70xaltuqbt8956gd1",
  5522                "Version": {
  5523                  "Index": 18
  5524                },
  5525                "CreatedAt": "2016-06-07T20:31:11.912919752Z",
  5526                "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
  5527                "Spec": {
  5528                  "Name": "ingress",
  5529                  "Labels": {
  5530                    "com.docker.swarm.internal": "true"
  5531                  },
  5532                  "DriverConfiguration": {},
  5533                  "IPAMOptions": {
  5534                    "Driver": {},
  5535                    "Configs": [
  5536                      {
  5537                        "Subnet": "10.255.0.0/16",
  5538                        "Gateway": "10.255.0.1"
  5539                      }
  5540                    ]
  5541                  }
  5542                },
  5543                "DriverState": {
  5544                  "Name": "overlay",
  5545                  "Options": {
  5546                    "com.docker.network.driver.overlay.vxlanid_list": "256"
  5547                  }
  5548                },
  5549                "IPAMOptions": {
  5550                  "Driver": {
  5551                    "Name": "default"
  5552                  },
  5553                  "Configs": [
  5554                    {
  5555                      "Subnet": "10.255.0.0/16",
  5556                      "Gateway": "10.255.0.1"
  5557                    }
  5558                  ]
  5559                }
  5560              },
  5561              "Addresses": [
  5562                "10.255.0.10/16"
  5563              ]
  5564            }
  5565          ],
  5566        },
  5567        {
  5568          "ID": "1yljwbmlr8er2waf8orvqpwms",
  5569          "Version": {
  5570            "Index": 30
  5571          },
  5572          "CreatedAt": "2016-06-07T21:07:30.019104782Z",
  5573          "UpdatedAt": "2016-06-07T21:07:30.231958098Z",
  5574          "Name": "hopeful_cori",
  5575          "Spec": {
  5576            "ContainerSpec": {
  5577              "Image": "redis"
  5578            },
  5579            "Resources": {
  5580              "Limits": {},
  5581              "Reservations": {}
  5582            },
  5583            "RestartPolicy": {
  5584              "Condition": "any",
  5585              "MaxAttempts": 0
  5586            },
  5587            "Placement": {}
  5588          },
  5589          "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  5590          "Slot": 1,
  5591          "NodeID": "60gvrl6tm78dmak4yl7srz94v",
  5592          "Status": {
  5593            "Timestamp": "2016-06-07T21:07:30.202183143Z",
  5594            "State": "shutdown",
  5595            "Message": "shutdown",
  5596            "ContainerStatus": {
  5597              "ContainerID": "1cf8d63d18e79668b0004a4be4c6ee58cddfad2dae29506d8781581d0688a213"
  5598            }
  5599          },
  5600          "DesiredState": "shutdown",
  5601          "NetworksAttachments": [
  5602            {
  5603              "Network": {
  5604                "ID": "4qvuz4ko70xaltuqbt8956gd1",
  5605                "Version": {
  5606                  "Index": 18
  5607                },
  5608                "CreatedAt": "2016-06-07T20:31:11.912919752Z",
  5609                "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
  5610                "Spec": {
  5611                  "Name": "ingress",
  5612                  "Labels": {
  5613                    "com.docker.swarm.internal": "true"
  5614                  },
  5615                  "DriverConfiguration": {},
  5616                  "IPAMOptions": {
  5617                    "Driver": {},
  5618                    "Configs": [
  5619                      {
  5620                        "Subnet": "10.255.0.0/16",
  5621                        "Gateway": "10.255.0.1"
  5622                      }
  5623                    ]
  5624                  }
  5625                },
  5626                "DriverState": {
  5627                  "Name": "overlay",
  5628                  "Options": {
  5629                    "com.docker.network.driver.overlay.vxlanid_list": "256"
  5630                  }
  5631                },
  5632                "IPAMOptions": {
  5633                  "Driver": {
  5634                    "Name": "default"
  5635                  },
  5636                  "Configs": [
  5637                    {
  5638                      "Subnet": "10.255.0.0/16",
  5639                      "Gateway": "10.255.0.1"
  5640                    }
  5641                  ]
  5642                }
  5643              },
  5644              "Addresses": [
  5645                "10.255.0.5/16"
  5646              ]
  5647            }
  5648          ]
  5649        }
  5650      ]
  5651  
  5652  **Query parameters**:
  5653  
  5654  - **filters** – a JSON encoded value of the filters (a `map[string][]string`) to process on the
  5655    services list. Available filters:
  5656    - `id=<task id>`
  5657    - `name=<task name>`
  5658    - `service=<service name>`
  5659    - `node=<node id or name>`
  5660    - `label=key` or `label="key=value"`
  5661    - `desired-state=(running | shutdown | accepted)`
  5662  
  5663  **Status codes**:
  5664  
  5665  - **200** – no error
  5666  - **500** – server error
  5667  
  5668  ### Inspect a task
  5669  
  5670  
  5671  `GET /tasks/(task id)`
  5672  
  5673  Get details on a task
  5674  
  5675  **Example request**:
  5676  
  5677      GET /tasks/0kzzo1i0y4jz6027t0k7aezc7 HTTP/1.1
  5678  
  5679  **Example response**:
  5680  
  5681      {
  5682        "ID": "0kzzo1i0y4jz6027t0k7aezc7",
  5683        "Version": {
  5684          "Index": 71
  5685        },
  5686        "CreatedAt": "2016-06-07T21:07:31.171892745Z",
  5687        "UpdatedAt": "2016-06-07T21:07:31.376370513Z",
  5688        "Spec": {
  5689          "ContainerSpec": {
  5690            "Image": "redis"
  5691          },
  5692          "Resources": {
  5693            "Limits": {},
  5694            "Reservations": {}
  5695          },
  5696          "RestartPolicy": {
  5697            "Condition": "any",
  5698            "MaxAttempts": 0
  5699          },
  5700          "Placement": {}
  5701        },
  5702        "ServiceID": "9mnpnzenvg8p8tdbtq4wvbkcz",
  5703        "Slot": 1,
  5704        "NodeID": "60gvrl6tm78dmak4yl7srz94v",
  5705        "Status": {
  5706          "Timestamp": "2016-06-07T21:07:31.290032978Z",
  5707          "State": "running",
  5708          "Message": "started",
  5709          "ContainerStatus": {
  5710            "ContainerID": "e5d62702a1b48d01c3e02ca1e0212a250801fa8d67caca0b6f35919ebc12f035",
  5711            "PID": 677
  5712          }
  5713        },
  5714        "DesiredState": "running",
  5715        "NetworksAttachments": [
  5716          {
  5717            "Network": {
  5718              "ID": "4qvuz4ko70xaltuqbt8956gd1",
  5719              "Version": {
  5720                "Index": 18
  5721              },
  5722              "CreatedAt": "2016-06-07T20:31:11.912919752Z",
  5723              "UpdatedAt": "2016-06-07T21:07:29.955277358Z",
  5724              "Spec": {
  5725                "Name": "ingress",
  5726                "Labels": {
  5727                  "com.docker.swarm.internal": "true"
  5728                },
  5729                "DriverConfiguration": {},
  5730                "IPAMOptions": {
  5731                  "Driver": {},
  5732                  "Configs": [
  5733                    {
  5734                      "Subnet": "10.255.0.0/16",
  5735                      "Gateway": "10.255.0.1"
  5736                    }
  5737                  ]
  5738                }
  5739              },
  5740              "DriverState": {
  5741                "Name": "overlay",
  5742                "Options": {
  5743                  "com.docker.network.driver.overlay.vxlanid_list": "256"
  5744                }
  5745              },
  5746              "IPAMOptions": {
  5747                "Driver": {
  5748                  "Name": "default"
  5749                },
  5750                "Configs": [
  5751                  {
  5752                    "Subnet": "10.255.0.0/16",
  5753                    "Gateway": "10.255.0.1"
  5754                  }
  5755                ]
  5756              }
  5757            },
  5758            "Addresses": [
  5759              "10.255.0.10/16"
  5760            ]
  5761          }
  5762        ]
  5763      }
  5764  
  5765  **Status codes**:
  5766  
  5767  - **200** – no error
  5768  - **404** – unknown task
  5769  - **500** – server error
  5770  
  5771  # 4. Going further
  5772  
  5773  ## 4.1 Inside `docker run`
  5774  
  5775  As an example, the `docker run` command line makes the following API calls:
  5776  
  5777  - Create the container
  5778  
  5779  - If the status code is 404, it means the image doesn't exist:
  5780      - Try to pull it.
  5781      - Then, retry to create the container.
  5782  
  5783  - Start the container.
  5784  
  5785  - If you are not in detached mode:
  5786  - Attach to the container, using `logs=1` (to have `stdout` and
  5787        `stderr` from the container's start) and `stream=1`
  5788  
  5789  - If in detached mode or only `stdin` is attached, display the container's id.
  5790  
  5791  ## 4.2 Hijacking
  5792  
  5793  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  5794  `stdout`, and `stderr` on the same socket.
  5795  
  5796  To hint potential proxies about connection hijacking, Docker client sends
  5797  connection upgrade headers similarly to websocket.
  5798  
  5799      Upgrade: tcp
  5800      Connection: Upgrade
  5801  
  5802  When Docker daemon detects the `Upgrade` header, it switches its status code
  5803  from **200 OK** to **101 UPGRADED** and resends the same headers.
  5804  
  5805  
  5806  ## 4.3 CORS Requests
  5807  
  5808  To set cross origin requests to the remote api please give values to
  5809  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  5810  default or blank means CORS disabled
  5811  
  5812      $ dockerd -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"