github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/docs/api/v1.24.md (about)

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