github.com/vieux/docker@v0.6.3-0.20161004191708-e097c2a938c7/docs/reference/api/docker_remote_api_v1.25.md (about)

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