github.com/45cali/docker@v1.11.1/docs/reference/api/docker_remote_api_v1.22.md (about)

     1  <!--[metadata]>
     2  +++
     3  title = "Remote API v1.22"
     4  description = "API Documentation for Docker"
     5  keywords = ["API, Docker, rcli, REST,  documentation"]
     6  [menu.main]
     7  parent="engine_remoteapi"
     8  weight=-3
     9  +++
    10  <![end-metadata]-->
    11  
    12  # Docker Remote API v1.22
    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](../../quickstart.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. Endpoints
    26  
    27  ## 2.1 Containers
    28  
    29  ### List containers
    30  
    31  `GET /containers/json`
    32  
    33  List containers
    34  
    35  **Example request**:
    36  
    37      GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1
    38  
    39  **Example response**:
    40  
    41      HTTP/1.1 200 OK
    42      Content-Type: application/json
    43  
    44      [
    45           {
    46                   "Id": "8dfafdbc3a40",
    47                   "Names":["/boring_feynman"],
    48                   "Image": "ubuntu:latest",
    49                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
    50                   "Command": "echo 1",
    51                   "Created": 1367854155,
    52                   "Status": "Exit 0",
    53                   "Ports": [{"PrivatePort": 2222, "PublicPort": 3333, "Type": "tcp"}],
    54                   "Labels": {
    55                           "com.example.vendor": "Acme",
    56                           "com.example.license": "GPL",
    57                           "com.example.version": "1.0"
    58                   },
    59                   "SizeRw": 12288,
    60                   "SizeRootFs": 0,
    61                   "HostConfig": {
    62                           "NetworkMode": "default"
    63                   },
    64                   "NetworkSettings": {
    65                           "Networks": {
    66                                   "bridge": {
    67                                            "IPAMConfig": null,
    68                                            "Links": null,
    69                                            "Aliases": null,
    70                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
    71                                            "EndpointID": "2cdc4edb1ded3631c81f57966563e5c8525b81121bb3706a9a9a3ae102711f3f",
    72                                            "Gateway": "172.17.0.1",
    73                                            "IPAddress": "172.17.0.2",
    74                                            "IPPrefixLen": 16,
    75                                            "IPv6Gateway": "",
    76                                            "GlobalIPv6Address": "",
    77                                            "GlobalIPv6PrefixLen": 0,
    78                                            "MacAddress": "02:42:ac:11:00:02"
    79                                    }
    80                           }
    81                   }
    82           },
    83           {
    84                   "Id": "9cd87474be90",
    85                   "Names":["/coolName"],
    86                   "Image": "ubuntu:latest",
    87                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
    88                   "Command": "echo 222222",
    89                   "Created": 1367854155,
    90                   "Status": "Exit 0",
    91                   "Ports": [],
    92                   "Labels": {},
    93                   "SizeRw": 12288,
    94                   "SizeRootFs": 0,
    95                   "HostConfig": {
    96                           "NetworkMode": "default"
    97                   },
    98                   "NetworkSettings": {
    99                           "Networks": {
   100                                   "bridge": {
   101                                            "IPAMConfig": null,
   102                                            "Links": null,
   103                                            "Aliases": null,
   104                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   105                                            "EndpointID": "88eaed7b37b38c2a3f0c4bc796494fdf51b270c2d22656412a2ca5d559a64d7a",
   106                                            "Gateway": "172.17.0.1",
   107                                            "IPAddress": "172.17.0.8",
   108                                            "IPPrefixLen": 16,
   109                                            "IPv6Gateway": "",
   110                                            "GlobalIPv6Address": "",
   111                                            "GlobalIPv6PrefixLen": 0,
   112                                            "MacAddress": "02:42:ac:11:00:08"
   113                                    }
   114                           }
   115                   }
   116  
   117           },
   118           {
   119                   "Id": "3176a2479c92",
   120                   "Names":["/sleepy_dog"],
   121                   "Image": "ubuntu:latest",
   122                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
   123                   "Command": "echo 3333333333333333",
   124                   "Created": 1367854154,
   125                   "Status": "Exit 0",
   126                   "Ports":[],
   127                   "Labels": {},
   128                   "SizeRw":12288,
   129                   "SizeRootFs":0,
   130                   "HostConfig": {
   131                           "NetworkMode": "default"
   132                   },
   133                   "NetworkSettings": {
   134                           "Networks": {
   135                                   "bridge": {
   136                                            "IPAMConfig": null,
   137                                            "Links": null,
   138                                            "Aliases": null,
   139                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   140                                            "EndpointID": "8b27c041c30326d59cd6e6f510d4f8d1d570a228466f956edf7815508f78e30d",
   141                                            "Gateway": "172.17.0.1",
   142                                            "IPAddress": "172.17.0.6",
   143                                            "IPPrefixLen": 16,
   144                                            "IPv6Gateway": "",
   145                                            "GlobalIPv6Address": "",
   146                                            "GlobalIPv6PrefixLen": 0,
   147                                            "MacAddress": "02:42:ac:11:00:06"
   148                                    }
   149                           }
   150                   }
   151  
   152           },
   153           {
   154                   "Id": "4cb07b47f9fb",
   155                   "Names":["/running_cat"],
   156                   "Image": "ubuntu:latest",
   157                   "ImageID": "d74508fb6632491cea586a1fd7d748dfc5274cd6fdfedee309ecdcbc2bf5cb82",
   158                   "Command": "echo 444444444444444444444444444444444",
   159                   "Created": 1367854152,
   160                   "Status": "Exit 0",
   161                   "Ports": [],
   162                   "Labels": {},
   163                   "SizeRw": 12288,
   164                   "SizeRootFs": 0,
   165                   "HostConfig": {
   166                           "NetworkMode": "default"
   167                   },
   168                   "NetworkSettings": {
   169                           "Networks": {
   170                                   "bridge": {
   171                                            "IPAMConfig": null,
   172                                            "Links": null,
   173                                            "Aliases": null,
   174                                            "NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   175                                            "EndpointID": "d91c7b2f0644403d7ef3095985ea0e2370325cd2332ff3a3225c4247328e66e9",
   176                                            "Gateway": "172.17.0.1",
   177                                            "IPAddress": "172.17.0.5",
   178                                            "IPPrefixLen": 16,
   179                                            "IPv6Gateway": "",
   180                                            "GlobalIPv6Address": "",
   181                                            "GlobalIPv6PrefixLen": 0,
   182                                            "MacAddress": "02:42:ac:11:00:05"
   183                                    }
   184                           }
   185                   }
   186  
   187           }
   188      ]
   189  
   190  Query Parameters:
   191  
   192  -   **all** – 1/True/true or 0/False/false, Show all containers.
   193          Only running containers are shown by default (i.e., this defaults to false)
   194  -   **limit** – Show `limit` last created
   195          containers, include non-running ones.
   196  -   **since** – Show only containers created since Id, include
   197          non-running ones.
   198  -   **before** – Show only containers created before Id, include
   199          non-running ones.
   200  -   **size** – 1/True/true or 0/False/false, Show the containers
   201          sizes
   202  -   **filters** - a JSON encoded value of the filters (a `map[string][]string`) to process on the containers list. Available filters:
   203    -   `exited=<int>`; -- containers with exit code of  `<int>` ;
   204    -   `status=`(`created`|`restarting`|`running`|`paused`|`exited`|`dead`)
   205    -   `label=key` or `label="key=value"` of a container label
   206    -   `isolation=`(`default`|`process`|`hyperv`)   (Windows daemon only)
   207  
   208  Status Codes:
   209  
   210  -   **200** – no error
   211  -   **400** – bad parameter
   212  -   **500** – server error
   213  
   214  ### Create a container
   215  
   216  `POST /containers/create`
   217  
   218  Create a container
   219  
   220  **Example request**:
   221  
   222      POST /containers/create HTTP/1.1
   223      Content-Type: application/json
   224  
   225      {
   226             "Hostname": "",
   227             "Domainname": "",
   228             "User": "",
   229             "AttachStdin": false,
   230             "AttachStdout": true,
   231             "AttachStderr": true,
   232             "Tty": false,
   233             "OpenStdin": false,
   234             "StdinOnce": false,
   235             "Env": [
   236                     "FOO=bar",
   237                     "BAZ=quux"
   238             ],
   239             "Cmd": [
   240                     "date"
   241             ],
   242             "Entrypoint": "",
   243             "Image": "ubuntu",
   244             "Labels": {
   245                     "com.example.vendor": "Acme",
   246                     "com.example.license": "GPL",
   247                     "com.example.version": "1.0"
   248             },
   249             "Volumes": {
   250               "/volumes/data": {}
   251             },
   252             "WorkingDir": "",
   253             "NetworkDisabled": false,
   254             "MacAddress": "12:34:56:78:9a:bc",
   255             "ExposedPorts": {
   256                     "22/tcp": {}
   257             },
   258             "StopSignal": "SIGTERM",
   259             "HostConfig": {
   260               "Binds": ["/tmp:/tmp"],
   261               "Links": ["redis3:redis"],
   262               "Memory": 0,
   263               "MemorySwap": 0,
   264               "MemoryReservation": 0,
   265               "KernelMemory": 0,
   266               "CpuShares": 512,
   267               "CpuPeriod": 100000,
   268               "CpuQuota": 50000,
   269               "CpusetCpus": "0,1",
   270               "CpusetMems": "0,1",
   271               "BlkioWeight": 300,
   272               "BlkioWeightDevice": [{}],
   273               "BlkioDeviceReadBps": [{}],
   274               "BlkioDeviceReadIOps": [{}],
   275               "BlkioDeviceWriteBps": [{}],
   276               "BlkioDeviceWriteIOps": [{}],
   277               "MemorySwappiness": 60,
   278               "OomKillDisable": false,
   279               "OomScoreAdj": 500,
   280               "PortBindings": { "22/tcp": [{ "HostPort": "11022" }] },
   281               "PublishAllPorts": false,
   282               "Privileged": false,
   283               "ReadonlyRootfs": false,
   284               "Dns": ["8.8.8.8"],
   285               "DnsOptions": [""],
   286               "DnsSearch": [""],
   287               "ExtraHosts": null,
   288               "VolumesFrom": ["parent", "other:ro"],
   289               "CapAdd": ["NET_ADMIN"],
   290               "CapDrop": ["MKNOD"],
   291               "GroupAdd": ["newgroup"],
   292               "RestartPolicy": { "Name": "", "MaximumRetryCount": 0 },
   293               "NetworkMode": "bridge",
   294               "Devices": [],
   295               "Ulimits": [{}],
   296               "LogConfig": { "Type": "json-file", "Config": {} },
   297               "SecurityOpt": [],
   298               "CgroupParent": "",
   299               "VolumeDriver": "",
   300               "ShmSize": 67108864
   301            },
   302            "NetworkingConfig": {
   303            "EndpointsConfig": {
   304                "isolated_nw" : {
   305                    "IPAMConfig": {
   306                        "IPv4Address":"172.20.30.33",
   307                        "IPv6Address":"2001:db8:abcd::3033"
   308                    },
   309                    "Links":["container_1", "container_2"],
   310                    "Aliases":["server_x", "server_y"]
   311                }
   312            }
   313        }
   314  
   315  **Example response**:
   316  
   317        HTTP/1.1 201 Created
   318        Content-Type: application/json
   319  
   320        {
   321             "Id":"e90e34656806",
   322             "Warnings":[]
   323        }
   324  
   325  Json Parameters:
   326  
   327  -   **Hostname** - A string value containing the hostname to use for the
   328        container.
   329  -   **Domainname** - A string value containing the domain name to use
   330        for the container.
   331  -   **User** - A string value specifying the user inside the container.
   332  -   **Memory** - Memory limit in bytes.
   333  -   **MemorySwap** - Total memory limit (memory + swap); set `-1` to enable unlimited swap.
   334        You must use this with `memory` and make the swap value larger than `memory`.
   335  -   **MemoryReservation** - Memory soft limit in bytes.
   336  -   **KernelMemory** - Kernel memory limit in bytes.
   337  -   **CpuShares** - An integer value containing the container's CPU Shares
   338        (ie. the relative weight vs other containers).
   339  -   **CpuPeriod** - The length of a CPU period in microseconds.
   340  -   **CpuQuota** - Microseconds of CPU time that the container can get in a CPU period.
   341  -   **Cpuset** - Deprecated please don't use. Use `CpusetCpus` instead.
   342  -   **CpusetCpus** - String value containing the `cgroups CpusetCpus` to use.
   343  -   **CpusetMems** - Memory nodes (MEMs) in which to allow execution (0-3, 0,1). Only effective on NUMA systems.
   344  -   **BlkioWeight** - Block IO weight (relative weight) accepts a weight value between 10 and 1000.
   345  -   **BlkioWeightDevice** - Block IO weight (relative device weight) in the form of:        `"BlkioWeightDevice": [{"Path": "device_path", "Weight": weight}]`
   346  -   **BlkioDeviceReadBps** - Limit read rate (bytes per second) from a device in the form of:	`"BlkioDeviceReadBps": [{"Path": "device_path", "Rate": rate}]`, for example:
   347  	`"BlkioDeviceReadBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
   348  -   **BlkioDeviceWriteBps** - Limit write rate (bytes per second) to a device in the form of:	`"BlkioDeviceWriteBps": [{"Path": "device_path", "Rate": rate}]`, for example:
   349  	`"BlkioDeviceWriteBps": [{"Path": "/dev/sda", "Rate": "1024"}]"`
   350  -   **BlkioDeviceReadIOps** - Limit read rate (IO per second) from a device in the form of:	`"BlkioDeviceReadIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
   351  	`"BlkioDeviceReadIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
   352  -   **BlkioDeviceWiiteIOps** - Limit write rate (IO per second) to a device in the form of:	`"BlkioDeviceWriteIOps": [{"Path": "device_path", "Rate": rate}]`, for example:
   353  	`"BlkioDeviceWriteIOps": [{"Path": "/dev/sda", "Rate": "1000"}]`
   354  -   **MemorySwappiness** - Tune a container's memory swappiness behavior. Accepts an integer between 0 and 100.
   355  -   **OomKillDisable** - Boolean value, whether to disable OOM Killer for the container or not.
   356  -   **OomScoreAdj** - An integer value containing the score given to the container in order to tune OOM killer preferences.
   357  -   **AttachStdin** - Boolean value, attaches to `stdin`.
   358  -   **AttachStdout** - Boolean value, attaches to `stdout`.
   359  -   **AttachStderr** - Boolean value, attaches to `stderr`.
   360  -   **Tty** - Boolean value, Attach standard streams to a `tty`, including `stdin` if it is not closed.
   361  -   **OpenStdin** - Boolean value, opens stdin,
   362  -   **StdinOnce** - Boolean value, close `stdin` after the 1 attached client disconnects.
   363  -   **Env** - A list of environment variables in the form of `["VAR=value"[,"VAR2=value2"]]`
   364  -   **Labels** - Adds a map of labels to a container. To specify a map: `{"key":"value"[,"key2":"value2"]}`
   365  -   **Cmd** - Command to run specified as a string or an array of strings.
   366  -   **Entrypoint** - Set the entry point for the container as a string or an array
   367        of strings.
   368  -   **Image** - A string specifying the image name to use for the container.
   369  -   **Volumes** - An object mapping mount point paths (strings) inside the
   370        container to empty objects.
   371  -   **WorkingDir** - A string specifying the working directory for commands to
   372        run in.
   373  -   **NetworkDisabled** - Boolean value, when true disables networking for the
   374        container
   375  -   **ExposedPorts** - An object mapping ports to an empty object in the form of:
   376        `"ExposedPorts": { "<port>/<tcp|udp>: {}" }`
   377  -   **StopSignal** - Signal to stop a container as a string or unsigned integer. `SIGTERM` by default.
   378  -   **HostConfig**
   379      -   **Binds** – A list of volume bindings for this container. Each volume binding is a string in one of these forms:
   380             + `host_path:container_path` to bind-mount a host path into the container
   381             + `host_path:container_path:ro` to make the bind-mount read-only inside the container.
   382             + `volume_name:container_path` to bind-mount a volume managed by a volume plugin into the container.
   383             + `volume_name:container_path:ro` to make the bind mount read-only inside the container.
   384      -   **Links** - A list of links for the container. Each link entry should be
   385            in the form of `container_name:alias`.
   386      -   **PortBindings** - A map of exposed container ports and the host port they
   387            should map to. A JSON object in the form
   388            `{ <port>/<protocol>: [{ "HostPort": "<port>" }] }`
   389            Take note that `port` is specified as a string and not an integer value.
   390      -   **PublishAllPorts** - Allocates a random host port for all of a container's
   391            exposed ports. Specified as a boolean value.
   392      -   **Privileged** - Gives the container full access to the host. Specified as
   393            a boolean value.
   394      -   **ReadonlyRootfs** - Mount the container's root filesystem as read only.
   395            Specified as a boolean value.
   396      -   **Dns** - A list of DNS servers for the container to use.
   397      -   **DnsOptions** - A list of DNS options
   398      -   **DnsSearch** - A list of DNS search domains
   399      -   **ExtraHosts** - A list of hostnames/IP mappings to add to the
   400          container's `/etc/hosts` file. Specified in the form `["hostname:IP"]`.
   401      -   **VolumesFrom** - A list of volumes to inherit from another container.
   402            Specified in the form `<container name>[:<ro|rw>]`
   403      -   **CapAdd** - A list of kernel capabilities to add to the container.
   404      -   **Capdrop** - A list of kernel capabilities to drop from the container.
   405      -   **GroupAdd** - A list of additional groups that the container process will run as
   406      -   **RestartPolicy** – The behavior to apply when the container exits.  The
   407              value is an object with a `Name` property of either `"always"` to
   408              always restart, `"unless-stopped"` to restart always except when
   409              user has manually stopped the container or `"on-failure"` to restart only when the container
   410              exit code is non-zero.  If `on-failure` is used, `MaximumRetryCount`
   411              controls the number of times to retry before giving up.
   412              The default is not to restart. (optional)
   413              An ever increasing delay (double the previous delay, starting at 100mS)
   414              is added before each restart to prevent flooding the server.
   415      -   **NetworkMode** - Sets the networking mode for the container. Supported
   416            standard values are: `bridge`, `host`, `none`, and `container:<name|id>`. Any other value is taken
   417            as a custom network's name to which this container should connect to.
   418      -   **Devices** - A list of devices to add to the container specified as a JSON object in the
   419        form
   420            `{ "PathOnHost": "/dev/deviceName", "PathInContainer": "/dev/deviceName", "CgroupPermissions": "mrw"}`
   421      -   **Ulimits** - A list of ulimits to set in the container, specified as
   422            `{ "Name": <name>, "Soft": <soft limit>, "Hard": <hard limit> }`, for example:
   423            `Ulimits: { "Name": "nofile", "Soft": 1024, "Hard": 2048 }`
   424      -   **SecurityOpt**: A list of string values to customize labels for MLS
   425          systems, such as SELinux.
   426      -   **LogConfig** - Log configuration for the container, specified as a JSON object in the form
   427            `{ "Type": "<driver_name>", "Config": {"key1": "val1"}}`.
   428            Available types: `json-file`, `syslog`, `journald`, `gelf`, `awslogs`, `splunk`, `none`.
   429            `json-file` logging driver.
   430      -   **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.
   431      -   **VolumeDriver** - Driver that this container users to mount volumes.
   432      -   **ShmSize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
   433  
   434  Query Parameters:
   435  
   436  -   **name** – Assign the specified name to the container. Must
   437      match `/?[a-zA-Z0-9_-]+`.
   438  
   439  Status Codes:
   440  
   441  -   **201** – no error
   442  -   **404** – no such container
   443  -   **406** – impossible to attach (container not running)
   444  -   **500** – server error
   445  
   446  ### Inspect a container
   447  
   448  `GET /containers/(id or name)/json`
   449  
   450  Return low-level information on the container `id`
   451  
   452  
   453  **Example request**:
   454  
   455        GET /containers/4fa6e0f0c678/json HTTP/1.1
   456  
   457  **Example response**:
   458  
   459      HTTP/1.1 200 OK
   460      Content-Type: application/json
   461  
   462      {
   463  		"AppArmorProfile": "",
   464  		"Args": [
   465  			"-c",
   466  			"exit 9"
   467  		],
   468  		"Config": {
   469  			"AttachStderr": true,
   470  			"AttachStdin": false,
   471  			"AttachStdout": true,
   472  			"Cmd": [
   473  				"/bin/sh",
   474  				"-c",
   475  				"exit 9"
   476  			],
   477  			"Domainname": "",
   478  			"Entrypoint": null,
   479  			"Env": [
   480  				"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
   481  			],
   482  			"ExposedPorts": null,
   483  			"Hostname": "ba033ac44011",
   484  			"Image": "ubuntu",
   485  			"Labels": {
   486  				"com.example.vendor": "Acme",
   487  				"com.example.license": "GPL",
   488  				"com.example.version": "1.0"
   489  			},
   490  			"MacAddress": "",
   491  			"NetworkDisabled": false,
   492  			"OnBuild": null,
   493  			"OpenStdin": false,
   494  			"StdinOnce": false,
   495  			"Tty": false,
   496  			"User": "",
   497  			"Volumes": {
   498                            "/volumes/data": {}
   499                          },
   500  			"WorkingDir": "",
   501  			"StopSignal": "SIGTERM"
   502  		},
   503  		"Created": "2015-01-06T15:47:31.485331387Z",
   504  		"Driver": "devicemapper",
   505  		"ExecDriver": "native-0.2",
   506  		"ExecIDs": null,
   507  		"HostConfig": {
   508  			"Binds": null,
   509  			"BlkioWeight": 0,
   510  			"BlkioWeightDevice": [{}],
   511  			"BlkioDeviceReadBps": [{}],
   512  			"BlkioDeviceWriteBps": [{}],
   513  			"BlkioDeviceReadIOps": [{}],
   514  			"BlkioDeviceWriteIOps": [{}],
   515  			"CapAdd": null,
   516  			"CapDrop": null,
   517  			"ContainerIDFile": "",
   518  			"CpusetCpus": "",
   519  			"CpusetMems": "",
   520  			"CpuShares": 0,
   521  			"CpuPeriod": 100000,
   522  			"Devices": [],
   523  			"Dns": null,
   524  			"DnsOptions": null,
   525  			"DnsSearch": null,
   526  			"ExtraHosts": null,
   527  			"IpcMode": "",
   528  			"Links": null,
   529  			"LxcConf": [],
   530  			"Memory": 0,
   531  			"MemorySwap": 0,
   532  			"MemoryReservation": 0,
   533  			"KernelMemory": 0,
   534  			"OomKillDisable": false,
   535  			"OomScoreAdj": 500,
   536  			"NetworkMode": "bridge",
   537  			"PortBindings": {},
   538  			"Privileged": false,
   539  			"ReadonlyRootfs": false,
   540  			"PublishAllPorts": false,
   541  			"RestartPolicy": {
   542  				"MaximumRetryCount": 2,
   543  				"Name": "on-failure"
   544  			},
   545  			"LogConfig": {
   546  				"Config": null,
   547  				"Type": "json-file"
   548  			},
   549  			"SecurityOpt": null,
   550  			"VolumesFrom": null,
   551  			"Ulimits": [{}],
   552  			"VolumeDriver": "",
   553  			"ShmSize": 67108864
   554  		},
   555  		"HostnamePath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hostname",
   556  		"HostsPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/hosts",
   557  		"LogPath": "/var/lib/docker/containers/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b/1eb5fabf5a03807136561b3c00adcd2992b535d624d5e18b6cdc6a6844d9767b-json.log",
   558  		"Id": "ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39",
   559  		"Image": "04c5d3b7b0656168630d3ba35d8889bd0e9caafcaeb3004d2bfbc47e7c5d35d2",
   560  		"MountLabel": "",
   561  		"Name": "/boring_euclid",
   562  		"NetworkSettings": {
   563  			"Bridge": "",
   564  			"SandboxID": "",
   565  			"HairpinMode": false,
   566  			"LinkLocalIPv6Address": "",
   567  			"LinkLocalIPv6PrefixLen": 0,
   568  			"Ports": null,
   569  			"SandboxKey": "",
   570  			"SecondaryIPAddresses": null,
   571  			"SecondaryIPv6Addresses": null,
   572  			"EndpointID": "",
   573  			"Gateway": "",
   574  			"GlobalIPv6Address": "",
   575  			"GlobalIPv6PrefixLen": 0,
   576  			"IPAddress": "",
   577  			"IPPrefixLen": 0,
   578  			"IPv6Gateway": "",
   579  			"MacAddress": "",
   580  			"Networks": {
   581  				"bridge": {
   582  					"NetworkID": "7ea29fc1412292a2d7bba362f9253545fecdfa8ce9a6e37dd10ba8bee7129812",
   583  					"EndpointID": "7587b82f0dada3656fda26588aee72630c6fab1536d36e394b2bfbcf898c971d",
   584  					"Gateway": "172.17.0.1",
   585  					"IPAddress": "172.17.0.2",
   586  					"IPPrefixLen": 16,
   587  					"IPv6Gateway": "",
   588  					"GlobalIPv6Address": "",
   589  					"GlobalIPv6PrefixLen": 0,
   590  					"MacAddress": "02:42:ac:12:00:02"
   591  				}
   592  			}
   593  		},
   594  		"Path": "/bin/sh",
   595  		"ProcessLabel": "",
   596  		"ResolvConfPath": "/var/lib/docker/containers/ba033ac4401106a3b513bc9d639eee123ad78ca3616b921167cd74b20e25ed39/resolv.conf",
   597  		"RestartCount": 1,
   598  		"State": {
   599  			"Error": "",
   600  			"ExitCode": 9,
   601  			"FinishedAt": "2015-01-06T15:47:32.080254511Z",
   602  			"OOMKilled": false,
   603  			"Dead": false,
   604  			"Paused": false,
   605  			"Pid": 0,
   606  			"Restarting": false,
   607  			"Running": true,
   608  			"StartedAt": "2015-01-06T15:47:32.072697474Z",
   609  			"Status": "running"
   610  		},
   611  		"Mounts": [
   612  			{
   613  				"Name": "fac362...80535",
   614  				"Source": "/data",
   615  				"Destination": "/data",
   616  				"Driver": "local",
   617  				"Mode": "ro,Z",
   618  				"RW": false,
   619  				"Propagation": ""
   620  			}
   621  		]
   622  	}
   623  
   624  **Example request, with size information**:
   625  
   626      GET /containers/4fa6e0f0c678/json?size=1 HTTP/1.1
   627  
   628  **Example response, with size information**:
   629  
   630      HTTP/1.1 200 OK
   631      Content-Type: application/json
   632  
   633      {
   634      ....
   635      "SizeRw": 0,
   636      "SizeRootFs": 972,
   637      ....
   638      }
   639  
   640  Query Parameters:
   641  
   642  -   **size** – 1/True/true or 0/False/false, return container size information. Default is `false`.
   643  
   644  Status Codes:
   645  
   646  -   **200** – no error
   647  -   **404** – no such container
   648  -   **500** – server error
   649  
   650  ### List processes running inside a container
   651  
   652  `GET /containers/(id or name)/top`
   653  
   654  List processes running inside the container `id`. On Unix systems this
   655  is done by running the `ps` command. This endpoint is not
   656  supported on Windows.
   657  
   658  **Example request**:
   659  
   660      GET /containers/4fa6e0f0c678/top HTTP/1.1
   661  
   662  **Example response**:
   663  
   664      HTTP/1.1 200 OK
   665      Content-Type: application/json
   666  
   667      {
   668         "Titles" : [
   669           "UID", "PID", "PPID", "C", "STIME", "TTY", "TIME", "CMD"
   670         ],
   671         "Processes" : [
   672           [
   673             "root", "13642", "882", "0", "17:03", "pts/0", "00:00:00", "/bin/bash"
   674           ],
   675           [
   676             "root", "13735", "13642", "0", "17:06", "pts/0", "00:00:00", "sleep 10"
   677           ]
   678         ]
   679      }
   680  
   681  **Example request**:
   682  
   683      GET /containers/4fa6e0f0c678/top?ps_args=aux HTTP/1.1
   684  
   685  **Example response**:
   686  
   687      HTTP/1.1 200 OK
   688      Content-Type: application/json
   689  
   690      {
   691        "Titles" : [
   692          "USER","PID","%CPU","%MEM","VSZ","RSS","TTY","STAT","START","TIME","COMMAND"
   693        ]
   694        "Processes" : [
   695          [
   696            "root","13642","0.0","0.1","18172","3184","pts/0","Ss","17:03","0:00","/bin/bash"
   697          ],
   698          [
   699            "root","13895","0.0","0.0","4348","692","pts/0","S+","17:15","0:00","sleep 10"
   700          ]
   701        ],
   702      }
   703  
   704  Query Parameters:
   705  
   706  -   **ps_args** – `ps` arguments to use (e.g., `aux`), defaults to `-ef`
   707  
   708  Status Codes:
   709  
   710  -   **200** – no error
   711  -   **404** – no such container
   712  -   **500** – server error
   713  
   714  ### Get container logs
   715  
   716  `GET /containers/(id or name)/logs`
   717  
   718  Get `stdout` and `stderr` logs from the container ``id``
   719  
   720  > **Note**:
   721  > This endpoint works only for containers with the `json-file` or `journald` logging drivers.
   722  
   723  **Example request**:
   724  
   725       GET /containers/4fa6e0f0c678/logs?stderr=1&stdout=1&timestamps=1&follow=1&tail=10&since=1428990821 HTTP/1.1
   726  
   727  **Example response**:
   728  
   729       HTTP/1.1 101 UPGRADED
   730       Content-Type: application/vnd.docker.raw-stream
   731       Connection: Upgrade
   732       Upgrade: tcp
   733  
   734       {{ STREAM }}
   735  
   736  Query Parameters:
   737  
   738  -   **follow** – 1/True/true or 0/False/false, return stream. Default `false`.
   739  -   **stdout** – 1/True/true or 0/False/false, show `stdout` log. Default `false`.
   740  -   **stderr** – 1/True/true or 0/False/false, show `stderr` log. Default `false`.
   741  -   **since** – UNIX timestamp (integer) to filter logs. Specifying a timestamp
   742      will only output log-entries since that timestamp. Default: 0 (unfiltered)
   743  -   **timestamps** – 1/True/true or 0/False/false, print timestamps for
   744          every log line. Default `false`.
   745  -   **tail** – Output specified number of lines at the end of logs: `all` or `<number>`. Default all.
   746  
   747  Status Codes:
   748  
   749  -   **101** – no error, hints proxy about hijacking
   750  -   **200** – no error, no upgrade header found
   751  -   **404** – no such container
   752  -   **500** – server error
   753  
   754  ### Inspect changes on a container's filesystem
   755  
   756  `GET /containers/(id or name)/changes`
   757  
   758  Inspect changes on container `id`'s filesystem
   759  
   760  **Example request**:
   761  
   762      GET /containers/4fa6e0f0c678/changes HTTP/1.1
   763  
   764  **Example response**:
   765  
   766      HTTP/1.1 200 OK
   767      Content-Type: application/json
   768  
   769      [
   770           {
   771                   "Path": "/dev",
   772                   "Kind": 0
   773           },
   774           {
   775                   "Path": "/dev/kmsg",
   776                   "Kind": 1
   777           },
   778           {
   779                   "Path": "/test",
   780                   "Kind": 1
   781           }
   782      ]
   783  
   784  Values for `Kind`:
   785  
   786  - `0`: Modify
   787  - `1`: Add
   788  - `2`: Delete
   789  
   790  Status Codes:
   791  
   792  -   **200** – no error
   793  -   **404** – no such container
   794  -   **500** – server error
   795  
   796  ### Export a container
   797  
   798  `GET /containers/(id or name)/export`
   799  
   800  Export the contents of container `id`
   801  
   802  **Example request**:
   803  
   804      GET /containers/4fa6e0f0c678/export HTTP/1.1
   805  
   806  **Example response**:
   807  
   808      HTTP/1.1 200 OK
   809      Content-Type: application/octet-stream
   810  
   811      {{ TAR STREAM }}
   812  
   813  Status Codes:
   814  
   815  -   **200** – no error
   816  -   **404** – no such container
   817  -   **500** – server error
   818  
   819  ### Get container stats based on resource usage
   820  
   821  `GET /containers/(id or name)/stats`
   822  
   823  This endpoint returns a live stream of a container's resource usage statistics.
   824  
   825  **Example request**:
   826  
   827      GET /containers/redis1/stats HTTP/1.1
   828  
   829  **Example response**:
   830  
   831        HTTP/1.1 200 OK
   832        Content-Type: application/json
   833  
   834        {
   835           "read" : "2015-01-08T22:57:31.547920715Z",
   836           "networks": {
   837                   "eth0": {
   838                       "rx_bytes": 5338,
   839                       "rx_dropped": 0,
   840                       "rx_errors": 0,
   841                       "rx_packets": 36,
   842                       "tx_bytes": 648,
   843                       "tx_dropped": 0,
   844                       "tx_errors": 0,
   845                       "tx_packets": 8
   846                   },
   847                   "eth5": {
   848                       "rx_bytes": 4641,
   849                       "rx_dropped": 0,
   850                       "rx_errors": 0,
   851                       "rx_packets": 26,
   852                       "tx_bytes": 690,
   853                       "tx_dropped": 0,
   854                       "tx_errors": 0,
   855                       "tx_packets": 9
   856                   }
   857           },
   858           "memory_stats" : {
   859              "stats" : {
   860                 "total_pgmajfault" : 0,
   861                 "cache" : 0,
   862                 "mapped_file" : 0,
   863                 "total_inactive_file" : 0,
   864                 "pgpgout" : 414,
   865                 "rss" : 6537216,
   866                 "total_mapped_file" : 0,
   867                 "writeback" : 0,
   868                 "unevictable" : 0,
   869                 "pgpgin" : 477,
   870                 "total_unevictable" : 0,
   871                 "pgmajfault" : 0,
   872                 "total_rss" : 6537216,
   873                 "total_rss_huge" : 6291456,
   874                 "total_writeback" : 0,
   875                 "total_inactive_anon" : 0,
   876                 "rss_huge" : 6291456,
   877                 "hierarchical_memory_limit" : 67108864,
   878                 "total_pgfault" : 964,
   879                 "total_active_file" : 0,
   880                 "active_anon" : 6537216,
   881                 "total_active_anon" : 6537216,
   882                 "total_pgpgout" : 414,
   883                 "total_cache" : 0,
   884                 "inactive_anon" : 0,
   885                 "active_file" : 0,
   886                 "pgfault" : 964,
   887                 "inactive_file" : 0,
   888                 "total_pgpgin" : 477
   889              },
   890              "max_usage" : 6651904,
   891              "usage" : 6537216,
   892              "failcnt" : 0,
   893              "limit" : 67108864
   894           },
   895           "blkio_stats" : {},
   896           "cpu_stats" : {
   897              "cpu_usage" : {
   898                 "percpu_usage" : [
   899                    8646879,
   900                    24472255,
   901                    36438778,
   902                    30657443
   903                 ],
   904                 "usage_in_usermode" : 50000000,
   905                 "total_usage" : 100215355,
   906                 "usage_in_kernelmode" : 30000000
   907              },
   908              "system_cpu_usage" : 739306590000000,
   909              "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
   910           },
   911           "precpu_stats" : {
   912              "cpu_usage" : {
   913                 "percpu_usage" : [
   914                    8646879,
   915                    24350896,
   916                    36438778,
   917                    30657443
   918                 ],
   919                 "usage_in_usermode" : 50000000,
   920                 "total_usage" : 100093996,
   921                 "usage_in_kernelmode" : 30000000
   922              },
   923              "system_cpu_usage" : 9492140000000,
   924              "throttling_data" : {"periods":0,"throttled_periods":0,"throttled_time":0}
   925           }
   926        }
   927  
   928  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.
   929  
   930  Query Parameters:
   931  
   932  -   **stream** – 1/True/true or 0/False/false, pull stats once then disconnect. Default `true`.
   933  
   934  Status Codes:
   935  
   936  -   **200** – no error
   937  -   **404** – no such container
   938  -   **500** – server error
   939  
   940  ### Resize a container TTY
   941  
   942  `POST /containers/(id or name)/resize`
   943  
   944  Resize the TTY for container with  `id`. The unit is number of characters. You must restart the container for the resize to take effect.
   945  
   946  **Example request**:
   947  
   948        POST /containers/4fa6e0f0c678/resize?h=40&w=80 HTTP/1.1
   949  
   950  **Example response**:
   951  
   952        HTTP/1.1 200 OK
   953        Content-Length: 0
   954        Content-Type: text/plain; charset=utf-8
   955  
   956  Query Parameters:
   957  
   958  -   **h** – height of `tty` session
   959  -   **w** – width
   960  
   961  Status Codes:
   962  
   963  -   **200** – no error
   964  -   **404** – No such container
   965  -   **500** – Cannot resize container
   966  
   967  ### Start a container
   968  
   969  `POST /containers/(id or name)/start`
   970  
   971  Start the container `id`
   972  
   973  > **Note**:
   974  > For backwards compatibility, this endpoint accepts a `HostConfig` as JSON-encoded request body.
   975  > See [create a container](#create-a-container) for details.
   976  
   977  **Example request**:
   978  
   979      POST /containers/e90e34656806/start HTTP/1.1
   980  
   981  **Example response**:
   982  
   983      HTTP/1.1 204 No Content
   984  
   985  Query Parameters:
   986  
   987  -   **detachKeys** – Override the key sequence for detaching a
   988          container. Format is a single character `[a-Z]` or `ctrl-<value>`
   989          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
   990  
   991  Status Codes:
   992  
   993  -   **204** – no error
   994  -   **304** – container already started
   995  -   **404** – no such container
   996  -   **500** – server error
   997  
   998  ### Stop a container
   999  
  1000  `POST /containers/(id or name)/stop`
  1001  
  1002  Stop the container `id`
  1003  
  1004  **Example request**:
  1005  
  1006      POST /containers/e90e34656806/stop?t=5 HTTP/1.1
  1007  
  1008  **Example response**:
  1009  
  1010      HTTP/1.1 204 No Content
  1011  
  1012  Query Parameters:
  1013  
  1014  -   **t** – number of seconds to wait before killing the container
  1015  
  1016  Status Codes:
  1017  
  1018  -   **204** – no error
  1019  -   **304** – container already stopped
  1020  -   **404** – no such container
  1021  -   **500** – server error
  1022  
  1023  ### Restart a container
  1024  
  1025  `POST /containers/(id or name)/restart`
  1026  
  1027  Restart the container `id`
  1028  
  1029  **Example request**:
  1030  
  1031      POST /containers/e90e34656806/restart?t=5 HTTP/1.1
  1032  
  1033  **Example response**:
  1034  
  1035      HTTP/1.1 204 No Content
  1036  
  1037  Query Parameters:
  1038  
  1039  -   **t** – number of seconds to wait before killing the container
  1040  
  1041  Status Codes:
  1042  
  1043  -   **204** – no error
  1044  -   **404** – no such container
  1045  -   **500** – server error
  1046  
  1047  ### Kill a container
  1048  
  1049  `POST /containers/(id or name)/kill`
  1050  
  1051  Kill the container `id`
  1052  
  1053  **Example request**:
  1054  
  1055      POST /containers/e90e34656806/kill HTTP/1.1
  1056  
  1057  **Example response**:
  1058  
  1059      HTTP/1.1 204 No Content
  1060  
  1061  Query Parameters
  1062  
  1063  -   **signal** - Signal to send to the container: integer or string like `SIGINT`.
  1064          When not set, `SIGKILL` is assumed and the call waits for the container to exit.
  1065  
  1066  Status Codes:
  1067  
  1068  -   **204** – no error
  1069  -   **404** – no such container
  1070  -   **500** – server error
  1071  
  1072  ### Update a container
  1073  
  1074  `POST /containers/(id or name)/update`
  1075  
  1076  Update resource configs of one or more containers.
  1077  
  1078  **Example request**:
  1079  
  1080         POST /containers/e90e34656806/update HTTP/1.1
  1081         Content-Type: application/json
  1082  
  1083         {
  1084           "BlkioWeight": 300,
  1085           "CpuShares": 512,
  1086           "CpuPeriod": 100000,
  1087           "CpuQuota": 50000,
  1088           "CpusetCpus": "0,1",
  1089           "CpusetMems": "0",
  1090           "Memory": 314572800,
  1091           "MemorySwap": 514288000,
  1092           "MemoryReservation": 209715200,
  1093           "KernelMemory": 52428800,
  1094         }
  1095  
  1096  **Example response**:
  1097  
  1098         HTTP/1.1 200 OK
  1099         Content-Type: application/json
  1100  
  1101         {
  1102             "Warnings": []
  1103         }
  1104  
  1105  Status Codes:
  1106  
  1107  -   **200** – no error
  1108  -   **400** – bad parameter
  1109  -   **404** – no such container
  1110  -   **500** – server error
  1111  
  1112  ### Rename a container
  1113  
  1114  `POST /containers/(id or name)/rename`
  1115  
  1116  Rename the container `id` to a `new_name`
  1117  
  1118  **Example request**:
  1119  
  1120      POST /containers/e90e34656806/rename?name=new_name HTTP/1.1
  1121  
  1122  **Example response**:
  1123  
  1124      HTTP/1.1 204 No Content
  1125  
  1126  Query Parameters:
  1127  
  1128  -   **name** – new name for the container
  1129  
  1130  Status Codes:
  1131  
  1132  -   **204** – no error
  1133  -   **404** – no such container
  1134  -   **409** - conflict name already assigned
  1135  -   **500** – server error
  1136  
  1137  ### Pause a container
  1138  
  1139  `POST /containers/(id or name)/pause`
  1140  
  1141  Pause the container `id`
  1142  
  1143  **Example request**:
  1144  
  1145      POST /containers/e90e34656806/pause HTTP/1.1
  1146  
  1147  **Example response**:
  1148  
  1149      HTTP/1.1 204 No Content
  1150  
  1151  Status Codes:
  1152  
  1153  -   **204** – no error
  1154  -   **404** – no such container
  1155  -   **500** – server error
  1156  
  1157  ### Unpause a container
  1158  
  1159  `POST /containers/(id or name)/unpause`
  1160  
  1161  Unpause the container `id`
  1162  
  1163  **Example request**:
  1164  
  1165      POST /containers/e90e34656806/unpause HTTP/1.1
  1166  
  1167  **Example response**:
  1168  
  1169      HTTP/1.1 204 No Content
  1170  
  1171  Status Codes:
  1172  
  1173  -   **204** – no error
  1174  -   **404** – no such container
  1175  -   **500** – server error
  1176  
  1177  ### Attach to a container
  1178  
  1179  `POST /containers/(id or name)/attach`
  1180  
  1181  Attach to the container `id`
  1182  
  1183  **Example request**:
  1184  
  1185      POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
  1186  
  1187  **Example response**:
  1188  
  1189      HTTP/1.1 101 UPGRADED
  1190      Content-Type: application/vnd.docker.raw-stream
  1191      Connection: Upgrade
  1192      Upgrade: tcp
  1193  
  1194      {{ STREAM }}
  1195  
  1196  Query Parameters:
  1197  
  1198  -   **detachKeys** – Override the key sequence for detaching a
  1199          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  1200          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  1201  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
  1202  -   **stream** – 1/True/true or 0/False/false, return stream.
  1203          Default `false`.
  1204  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1205          to `stdin`. Default `false`.
  1206  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1207          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1208  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1209          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1210  
  1211  Status Codes:
  1212  
  1213  -   **101** – no error, hints proxy about hijacking
  1214  -   **200** – no error, no upgrade header found
  1215  -   **400** – bad parameter
  1216  -   **404** – no such container
  1217  -   **500** – server error
  1218  
  1219      **Stream details**:
  1220  
  1221      When using the TTY setting is enabled in
  1222      [`POST /containers/create`
  1223      ](#create-a-container),
  1224      the stream is the raw data from the process PTY and client's `stdin`.
  1225      When the TTY is disabled, then the stream is multiplexed to separate
  1226      `stdout` and `stderr`.
  1227  
  1228      The format is a **Header** and a **Payload** (frame).
  1229  
  1230      **HEADER**
  1231  
  1232      The header contains the information which the stream writes (`stdout` or
  1233      `stderr`). It also contains the size of the associated frame encoded in the
  1234      last four bytes (`uint32`).
  1235  
  1236      It is encoded on the first eight bytes like this:
  1237  
  1238          header := [8]byte{STREAM_TYPE, 0, 0, 0, SIZE1, SIZE2, SIZE3, SIZE4}
  1239  
  1240      `STREAM_TYPE` can be:
  1241  
  1242  -   0: `stdin` (is written on `stdout`)
  1243  -   1: `stdout`
  1244  -   2: `stderr`
  1245  
  1246      `SIZE1, SIZE2, SIZE3, SIZE4` are the four bytes of
  1247      the `uint32` size encoded as big endian.
  1248  
  1249      **PAYLOAD**
  1250  
  1251      The payload is the raw stream.
  1252  
  1253      **IMPLEMENTATION**
  1254  
  1255      The simplest way to implement the Attach protocol is the following:
  1256  
  1257      1.  Read eight bytes.
  1258      2.  Choose `stdout` or `stderr` depending on the first byte.
  1259      3.  Extract the frame size from the last four bytes.
  1260      4.  Read the extracted size and output it on the correct output.
  1261      5.  Goto 1.
  1262  
  1263  ### Attach to a container (websocket)
  1264  
  1265  `GET /containers/(id or name)/attach/ws`
  1266  
  1267  Attach to the container `id` via websocket
  1268  
  1269  Implements websocket protocol handshake according to [RFC 6455](http://tools.ietf.org/html/rfc6455)
  1270  
  1271  **Example request**
  1272  
  1273      GET /containers/e90e34656806/attach/ws?logs=0&stream=1&stdin=1&stdout=1&stderr=1 HTTP/1.1
  1274  
  1275  **Example response**
  1276  
  1277      {{ STREAM }}
  1278  
  1279  Query Parameters:
  1280  
  1281  -   **detachKeys** – Override the key sequence for detaching a
  1282          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  1283          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  1284  -   **logs** – 1/True/true or 0/False/false, return logs. Default `false`.
  1285  -   **stream** – 1/True/true or 0/False/false, return stream.
  1286          Default `false`.
  1287  -   **stdin** – 1/True/true or 0/False/false, if `stream=true`, attach
  1288          to `stdin`. Default `false`.
  1289  -   **stdout** – 1/True/true or 0/False/false, if `logs=true`, return
  1290          `stdout` log, if `stream=true`, attach to `stdout`. Default `false`.
  1291  -   **stderr** – 1/True/true or 0/False/false, if `logs=true`, return
  1292          `stderr` log, if `stream=true`, attach to `stderr`. Default `false`.
  1293  
  1294  Status Codes:
  1295  
  1296  -   **200** – no error
  1297  -   **400** – bad parameter
  1298  -   **404** – no such container
  1299  -   **500** – server error
  1300  
  1301  ### Wait a container
  1302  
  1303  `POST /containers/(id or name)/wait`
  1304  
  1305  Block until container `id` stops, then returns the exit code
  1306  
  1307  **Example request**:
  1308  
  1309      POST /containers/16253994b7c4/wait HTTP/1.1
  1310  
  1311  **Example response**:
  1312  
  1313      HTTP/1.1 200 OK
  1314      Content-Type: application/json
  1315  
  1316      {"StatusCode": 0}
  1317  
  1318  Status Codes:
  1319  
  1320  -   **200** – no error
  1321  -   **404** – no such container
  1322  -   **500** – server error
  1323  
  1324  ### Remove a container
  1325  
  1326  `DELETE /containers/(id or name)`
  1327  
  1328  Remove the container `id` from the filesystem
  1329  
  1330  **Example request**:
  1331  
  1332      DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  1333  
  1334  **Example response**:
  1335  
  1336      HTTP/1.1 204 No Content
  1337  
  1338  Query Parameters:
  1339  
  1340  -   **v** – 1/True/true or 0/False/false, Remove the volumes
  1341          associated to the container. Default `false`.
  1342  -   **force** - 1/True/true or 0/False/false, Kill then remove the container.
  1343          Default `false`.
  1344  
  1345  Status Codes:
  1346  
  1347  -   **204** – no error
  1348  -   **400** – bad parameter
  1349  -   **404** – no such container
  1350  -   **500** – server error
  1351  
  1352  ### Copy files or folders from a container
  1353  
  1354  `POST /containers/(id or name)/copy`
  1355  
  1356  Copy files or folders of container `id`
  1357  
  1358  **Deprecated** in favor of the `archive` endpoint below.
  1359  
  1360  **Example request**:
  1361  
  1362      POST /containers/4fa6e0f0c678/copy HTTP/1.1
  1363      Content-Type: application/json
  1364  
  1365      {
  1366           "Resource": "test.txt"
  1367      }
  1368  
  1369  **Example response**:
  1370  
  1371      HTTP/1.1 200 OK
  1372      Content-Type: application/x-tar
  1373  
  1374      {{ TAR STREAM }}
  1375  
  1376  Status Codes:
  1377  
  1378  -   **200** – no error
  1379  -   **404** – no such container
  1380  -   **500** – server error
  1381  
  1382  ### Retrieving information about files and folders in a container
  1383  
  1384  `HEAD /containers/(id or name)/archive`
  1385  
  1386  See the description of the `X-Docker-Container-Path-Stat` header in the
  1387  following section.
  1388  
  1389  ### Get an archive of a filesystem resource in a container
  1390  
  1391  `GET /containers/(id or name)/archive`
  1392  
  1393  Get an tar archive of a resource in the filesystem of container `id`.
  1394  
  1395  Query Parameters:
  1396  
  1397  - **path** - resource in the container's filesystem to archive. Required.
  1398  
  1399      If not an absolute path, it is relative to the container's root directory.
  1400      The resource specified by **path** must exist. To assert that the resource
  1401      is expected to be a directory, **path** should end in `/` or  `/.`
  1402      (assuming a path separator of `/`). If **path** ends in `/.` then this
  1403      indicates that only the contents of the **path** directory should be
  1404      copied. A symlink is always resolved to its target.
  1405  
  1406      **Note**: It is not possible to copy certain system files such as resources
  1407      under `/proc`, `/sys`, `/dev`, and mounts created by the user in the
  1408      container.
  1409  
  1410  **Example request**:
  1411  
  1412          GET /containers/8cce319429b2/archive?path=/root HTTP/1.1
  1413  
  1414  **Example response**:
  1415  
  1416          HTTP/1.1 200 OK
  1417          Content-Type: application/x-tar
  1418          X-Docker-Container-Path-Stat: eyJuYW1lIjoicm9vdCIsInNpemUiOjQwOTYsIm1vZGUiOjIxNDc0ODQwOTYsIm10aW1lIjoiMjAxNC0wMi0yN1QyMDo1MToyM1oiLCJsaW5rVGFyZ2V0IjoiIn0=
  1419  
  1420          {{ TAR STREAM }}
  1421  
  1422  On success, a response header `X-Docker-Container-Path-Stat` will be set to a
  1423  base64-encoded JSON object containing some filesystem header information about
  1424  the archived resource. The above example value would decode to the following
  1425  JSON object (whitespace added for readability):
  1426  
  1427          {
  1428              "name": "root",
  1429              "size": 4096,
  1430              "mode": 2147484096,
  1431              "mtime": "2014-02-27T20:51:23Z",
  1432              "linkTarget": ""
  1433          }
  1434  
  1435  A `HEAD` request can also be made to this endpoint if only this information is
  1436  desired.
  1437  
  1438  Status Codes:
  1439  
  1440  - **200** - success, returns archive of copied resource
  1441  - **400** - client error, bad parameter, details in JSON response body, one of:
  1442      - must specify path parameter (**path** cannot be empty)
  1443      - not a directory (**path** was asserted to be a directory but exists as a
  1444        file)
  1445  - **404** - client error, resource not found, one of:
  1446      – no such container (container `id` does not exist)
  1447      - no such file or directory (**path** does not exist)
  1448  - **500** - server error
  1449  
  1450  ### Extract an archive of files or folders to a directory in a container
  1451  
  1452  `PUT /containers/(id or name)/archive`
  1453  
  1454  Upload a tar archive to be extracted to a path in the filesystem of container
  1455  `id`.
  1456  
  1457  Query Parameters:
  1458  
  1459  - **path** - path to a directory in the container
  1460      to extract the archive's contents into. Required.
  1461  
  1462      If not an absolute path, it is relative to the container's root directory.
  1463      The **path** resource must exist.
  1464  - **noOverwriteDirNonDir** - If "1", "true", or "True" then it will be an error
  1465      if unpacking the given content would cause an existing directory to be
  1466      replaced with a non-directory and vice versa.
  1467  
  1468  **Example request**:
  1469  
  1470      PUT /containers/8cce319429b2/archive?path=/vol1 HTTP/1.1
  1471      Content-Type: application/x-tar
  1472  
  1473      {{ TAR STREAM }}
  1474  
  1475  **Example response**:
  1476  
  1477      HTTP/1.1 200 OK
  1478  
  1479  Status Codes:
  1480  
  1481  - **200** – the content was extracted successfully
  1482  - **400** - client error, bad parameter, details in JSON response body, one of:
  1483      - must specify path parameter (**path** cannot be empty)
  1484      - not a directory (**path** should be a directory but exists as a file)
  1485      - unable to overwrite existing directory with non-directory
  1486        (if **noOverwriteDirNonDir**)
  1487      - unable to overwrite existing non-directory with directory
  1488        (if **noOverwriteDirNonDir**)
  1489  - **403** - client error, permission denied, the volume
  1490      or container rootfs is marked as read-only.
  1491  - **404** - client error, resource not found, one of:
  1492      – no such container (container `id` does not exist)
  1493      - no such file or directory (**path** resource does not exist)
  1494  - **500** – server error
  1495  
  1496  ## 2.2 Images
  1497  
  1498  ### List Images
  1499  
  1500  `GET /images/json`
  1501  
  1502  **Example request**:
  1503  
  1504      GET /images/json?all=0 HTTP/1.1
  1505  
  1506  **Example response**:
  1507  
  1508      HTTP/1.1 200 OK
  1509      Content-Type: application/json
  1510  
  1511      [
  1512        {
  1513           "RepoTags": [
  1514             "ubuntu:12.04",
  1515             "ubuntu:precise",
  1516             "ubuntu:latest"
  1517           ],
  1518           "Id": "8dbd9e392a964056420e5d58ca5cc376ef18e2de93b5cc90e868a1bbc8318c1c",
  1519           "Created": 1365714795,
  1520           "Size": 131506275,
  1521           "VirtualSize": 131506275,
  1522           "Labels": {}
  1523        },
  1524        {
  1525           "RepoTags": [
  1526             "ubuntu:12.10",
  1527             "ubuntu:quantal"
  1528           ],
  1529           "ParentId": "27cf784147099545",
  1530           "Id": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  1531           "Created": 1364102658,
  1532           "Size": 24653,
  1533           "VirtualSize": 180116135,
  1534           "Labels": {
  1535              "com.example.version": "v1"
  1536           }
  1537        }
  1538      ]
  1539  
  1540  **Example request, with digest information**:
  1541  
  1542      GET /images/json?digests=1 HTTP/1.1
  1543  
  1544  **Example response, with digest information**:
  1545  
  1546      HTTP/1.1 200 OK
  1547      Content-Type: application/json
  1548  
  1549      [
  1550        {
  1551          "Created": 1420064636,
  1552          "Id": "4986bf8c15363d1c5d15512d5266f8777bfba4974ac56e3270e7760f6f0a8125",
  1553          "ParentId": "ea13149945cb6b1e746bf28032f02e9b5a793523481a0a18645fc77ad53c4ea2",
  1554          "RepoDigests": [
  1555            "localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1556          ],
  1557          "RepoTags": [
  1558            "localhost:5000/test/busybox:latest",
  1559            "playdate:latest"
  1560          ],
  1561          "Size": 0,
  1562          "VirtualSize": 2429728,
  1563          "Labels": {}
  1564        }
  1565      ]
  1566  
  1567  The response shows a single image `Id` associated with two repositories
  1568  (`RepoTags`): `localhost:5000/test/busybox`: and `playdate`. A caller can use
  1569  either of the `RepoTags` values `localhost:5000/test/busybox:latest` or
  1570  `playdate:latest` to reference the image.
  1571  
  1572  You can also use `RepoDigests` values to reference an image. In this response,
  1573  the array has only one reference and that is to the
  1574  `localhost:5000/test/busybox` repository; the `playdate` repository has no
  1575  digest. You can reference this digest using the value:
  1576  `localhost:5000/test/busybox@sha256:cbbf2f9a99b47fc460d...`
  1577  
  1578  See the `docker run` and `docker build` commands for examples of digest and tag
  1579  references on the command line.
  1580  
  1581  Query Parameters:
  1582  
  1583  -   **all** – 1/True/true or 0/False/false, default false
  1584  -   **filters** – a JSON encoded value of the filters (a map[string][]string) to process on the images list. Available filters:
  1585    -   `dangling=true`
  1586    -   `label=key` or `label="key=value"` of an image label
  1587  -   **filter** - only return images with the specified name
  1588  
  1589  ### Build image from a Dockerfile
  1590  
  1591  `POST /build`
  1592  
  1593  Build an image from a Dockerfile
  1594  
  1595  **Example request**:
  1596  
  1597      POST /build HTTP/1.1
  1598  
  1599      {{ TAR STREAM }}
  1600  
  1601  **Example response**:
  1602  
  1603      HTTP/1.1 200 OK
  1604      Content-Type: application/json
  1605  
  1606      {"stream": "Step 1..."}
  1607      {"stream": "..."}
  1608      {"error": "Error...", "errorDetail": {"code": 123, "message": "Error..."}}
  1609  
  1610  The input stream must be a `tar` archive compressed with one of the
  1611  following algorithms: `identity` (no compression), `gzip`, `bzip2`, `xz`.
  1612  
  1613  The archive must include a build instructions file, typically called
  1614  `Dockerfile` at the archive's root. The `dockerfile` parameter may be
  1615  used to specify a different build instructions file. To do this, its value must be
  1616  the path to the alternate build instructions file to use.
  1617  
  1618  The archive may include any number of other files,
  1619  which are accessible in the build context (See the [*ADD build
  1620  command*](../../reference/builder.md#dockerbuilder)).
  1621  
  1622  The build is canceled if the client drops the connection by quitting
  1623  or being killed.
  1624  
  1625  Query Parameters:
  1626  
  1627  -   **dockerfile** - Path within the build context to the Dockerfile. This is
  1628          ignored if `remote` is specified and points to an individual filename.
  1629  -   **t** – A name and optional tag to apply to the image in the `name:tag` format.
  1630          If you omit the `tag` the default `latest` value is assumed.
  1631          You can provide one or more `t` parameters.
  1632  -   **remote** – A Git repository URI or HTTP/HTTPS URI build source. If the
  1633          URI specifies a filename, the file's contents are placed into a file
  1634  		called `Dockerfile`.
  1635  -   **q** – Suppress verbose build output.
  1636  -   **nocache** – Do not use the cache when building the image.
  1637  -   **pull** - Attempt to pull the image even if an older image exists locally.
  1638  -   **rm** - Remove intermediate containers after a successful build (default behavior).
  1639  -   **forcerm** - Always remove intermediate containers (includes `rm`).
  1640  -   **memory** - Set memory limit for build.
  1641  -   **memswap** - Total memory (memory + swap), `-1` to enable unlimited swap.
  1642  -   **cpushares** - CPU shares (relative weight).
  1643  -   **cpusetcpus** - CPUs in which to allow execution (e.g., `0-3`, `0,1`).
  1644  -   **cpuperiod** - The length of a CPU period in microseconds.
  1645  -   **cpuquota** - Microseconds of CPU time that the container can get in a CPU period.
  1646  -   **buildargs** – JSON map of string pairs for build-time variables. Users pass
  1647          these values at build-time. Docker uses the `buildargs` as the environment
  1648          context for command(s) run via the Dockerfile's `RUN` instruction or for
  1649          variable expansion in other Dockerfile instructions. This is not meant for
  1650          passing secret values. [Read more about the buildargs instruction](../../reference/builder.md#arg)
  1651  -   **shmsize** - Size of `/dev/shm` in bytes. The size must be greater than 0.  If omitted the system uses 64MB.
  1652  
  1653      Request Headers:
  1654  
  1655  -   **Content-type** – Set to `"application/tar"`.
  1656  -   **X-Registry-Config** – A base64-url-safe-encoded Registry Auth Config JSON
  1657          object with the following structure:
  1658  
  1659              {
  1660                  "docker.example.com": {
  1661                      "username": "janedoe",
  1662                      "password": "hunter2"
  1663                  },
  1664                  "https://index.docker.io/v1/": {
  1665                      "username": "mobydock",
  1666                      "password": "conta1n3rize14"
  1667                  }
  1668              }
  1669  
  1670          This object maps the hostname of a registry to an object containing the
  1671          "username" and "password" for that registry. Multiple registries may
  1672          be specified as the build may be based on an image requiring
  1673          authentication to pull from any arbitrary registry. Only the registry
  1674          domain name (and port if not the default "443") are required. However
  1675          (for legacy reasons) the "official" Docker, Inc. hosted registry must
  1676          be specified with both a "https://" prefix and a "/v1/" suffix even
  1677          though Docker will prefer to use the v2 registry API.
  1678  
  1679  Status Codes:
  1680  
  1681  -   **200** – no error
  1682  -   **500** – server error
  1683  
  1684  ### Create an image
  1685  
  1686  `POST /images/create`
  1687  
  1688  Create an image either by pulling it from the registry or by importing it
  1689  
  1690  **Example request**:
  1691  
  1692      POST /images/create?fromImage=ubuntu HTTP/1.1
  1693  
  1694  **Example response**:
  1695  
  1696      HTTP/1.1 200 OK
  1697      Content-Type: application/json
  1698  
  1699      {"status": "Pulling..."}
  1700      {"status": "Pulling", "progress": "1 B/ 100 B", "progressDetail": {"current": 1, "total": 100}}
  1701      {"error": "Invalid..."}
  1702      ...
  1703  
  1704  When using this endpoint to pull an image from the registry, the
  1705  `X-Registry-Auth` header can be used to include
  1706  a base64-encoded AuthConfig object.
  1707  
  1708  Query Parameters:
  1709  
  1710  -   **fromImage** – Name of the image to pull. The name may include a tag or
  1711          digest. This parameter may only be used when pulling an image.
  1712          The pull is cancelled if the HTTP connection is closed.
  1713  -   **fromSrc** – Source to import.  The value may be a URL from which the image
  1714          can be retrieved or `-` to read the image from the request body.
  1715          This parameter may only be used when importing an image.
  1716  -   **repo** – Repository name given to an image when it is imported.
  1717          The repo may include a tag. This parameter may only be used when importing
  1718          an image.
  1719  -   **tag** – Tag or digest.
  1720  
  1721      Request Headers:
  1722  
  1723  -   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
  1724      - Credential based login:
  1725  
  1726          ```
  1727      {
  1728              "username": "jdoe",
  1729              "password": "secret",
  1730              "email": "jdoe@acme.com",
  1731      }
  1732          ```
  1733  
  1734      - Token based login:
  1735  
  1736          ```
  1737      {
  1738              "registrytoken": "9cbaf023786cd7..."
  1739      }
  1740          ```
  1741  
  1742  Status Codes:
  1743  
  1744  -   **200** – no error
  1745  -   **500** – server error
  1746  
  1747  
  1748  
  1749  ### Inspect an image
  1750  
  1751  `GET /images/(name)/json`
  1752  
  1753  Return low-level information on the image `name`
  1754  
  1755  **Example request**:
  1756  
  1757      GET /images/example/json HTTP/1.1
  1758  
  1759  **Example response**:
  1760  
  1761      HTTP/1.1 200 OK
  1762      Content-Type: application/json
  1763  
  1764      {
  1765         "Id" : "85f05633ddc1c50679be2b16a0479ab6f7637f8884e0cfe0f4d20e1ebb3d6e7c",
  1766         "Container" : "cb91e48a60d01f1e27028b4fc6819f4f290b3cf12496c8176ec714d0d390984a",
  1767         "Comment" : "",
  1768         "Os" : "linux",
  1769         "Architecture" : "amd64",
  1770         "Parent" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1771         "ContainerConfig" : {
  1772            "Tty" : false,
  1773            "Hostname" : "e611e15f9c9d",
  1774            "Volumes" : null,
  1775            "Domainname" : "",
  1776            "AttachStdout" : false,
  1777            "PublishService" : "",
  1778            "AttachStdin" : false,
  1779            "OpenStdin" : false,
  1780            "StdinOnce" : false,
  1781            "NetworkDisabled" : false,
  1782            "OnBuild" : [],
  1783            "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1784            "User" : "",
  1785            "WorkingDir" : "",
  1786            "Entrypoint" : null,
  1787            "MacAddress" : "",
  1788            "AttachStderr" : false,
  1789            "Labels" : {
  1790               "com.example.license" : "GPL",
  1791               "com.example.version" : "1.0",
  1792               "com.example.vendor" : "Acme"
  1793            },
  1794            "Env" : [
  1795               "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  1796            ],
  1797            "ExposedPorts" : null,
  1798            "Cmd" : [
  1799               "/bin/sh",
  1800               "-c",
  1801               "#(nop) LABEL com.example.vendor=Acme com.example.license=GPL com.example.version=1.0"
  1802            ]
  1803         },
  1804         "DockerVersion" : "1.9.0-dev",
  1805         "VirtualSize" : 188359297,
  1806         "Size" : 0,
  1807         "Author" : "",
  1808         "Created" : "2015-09-10T08:30:53.26995814Z",
  1809         "GraphDriver" : {
  1810            "Name" : "aufs",
  1811            "Data" : null
  1812         },
  1813         "RepoDigests" : [
  1814            "localhost:5000/test/busybox/example@sha256:cbbf2f9a99b47fc460d422812b6a5adff7dfee951d8fa2e4a98caa0382cfbdbf"
  1815         ],
  1816         "RepoTags" : [
  1817            "example:1.0",
  1818            "example:latest",
  1819            "example:stable"
  1820         ],
  1821         "Config" : {
  1822            "Image" : "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
  1823            "NetworkDisabled" : false,
  1824            "OnBuild" : [],
  1825            "StdinOnce" : false,
  1826            "PublishService" : "",
  1827            "AttachStdin" : false,
  1828            "OpenStdin" : false,
  1829            "Domainname" : "",
  1830            "AttachStdout" : false,
  1831            "Tty" : false,
  1832            "Hostname" : "e611e15f9c9d",
  1833            "Volumes" : null,
  1834            "Cmd" : [
  1835               "/bin/bash"
  1836            ],
  1837            "ExposedPorts" : null,
  1838            "Env" : [
  1839               "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  1840            ],
  1841            "Labels" : {
  1842               "com.example.vendor" : "Acme",
  1843               "com.example.version" : "1.0",
  1844               "com.example.license" : "GPL"
  1845            },
  1846            "Entrypoint" : null,
  1847            "MacAddress" : "",
  1848            "AttachStderr" : false,
  1849            "WorkingDir" : "",
  1850            "User" : ""
  1851         }
  1852      }
  1853  
  1854  Status Codes:
  1855  
  1856  -   **200** – no error
  1857  -   **404** – no such image
  1858  -   **500** – server error
  1859  
  1860  ### Get the history of an image
  1861  
  1862  `GET /images/(name)/history`
  1863  
  1864  Return the history of the image `name`
  1865  
  1866  **Example request**:
  1867  
  1868      GET /images/ubuntu/history HTTP/1.1
  1869  
  1870  **Example response**:
  1871  
  1872      HTTP/1.1 200 OK
  1873      Content-Type: application/json
  1874  
  1875      [
  1876          {
  1877              "Id": "3db9c44f45209632d6050b35958829c3a2aa256d81b9a7be45b362ff85c54710",
  1878              "Created": 1398108230,
  1879              "CreatedBy": "/bin/sh -c #(nop) ADD file:eb15dbd63394e063b805a3c32ca7bf0266ef64676d5a6fab4801f2e81e2a5148 in /",
  1880              "Tags": [
  1881                  "ubuntu:lucid",
  1882                  "ubuntu:10.04"
  1883              ],
  1884              "Size": 182964289,
  1885              "Comment": ""
  1886          },
  1887          {
  1888              "Id": "6cfa4d1f33fb861d4d114f43b25abd0ac737509268065cdfd69d544a59c85ab8",
  1889              "Created": 1398108222,
  1890              "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/",
  1891              "Tags": null,
  1892              "Size": 0,
  1893              "Comment": ""
  1894          },
  1895          {
  1896              "Id": "511136ea3c5a64f264b78b5433614aec563103b4d4702f3ba7d4d2698e22c158",
  1897              "Created": 1371157430,
  1898              "CreatedBy": "",
  1899              "Tags": [
  1900                  "scratch12:latest",
  1901                  "scratch:latest"
  1902              ],
  1903              "Size": 0,
  1904              "Comment": "Imported from -"
  1905          }
  1906      ]
  1907  
  1908  Status Codes:
  1909  
  1910  -   **200** – no error
  1911  -   **404** – no such image
  1912  -   **500** – server error
  1913  
  1914  ### Push an image on the registry
  1915  
  1916  `POST /images/(name)/push`
  1917  
  1918  Push the image `name` on the registry
  1919  
  1920  **Example request**:
  1921  
  1922      POST /images/test/push HTTP/1.1
  1923  
  1924  **Example response**:
  1925  
  1926      HTTP/1.1 200 OK
  1927      Content-Type: application/json
  1928  
  1929      {"status": "Pushing..."}
  1930      {"status": "Pushing", "progress": "1/? (n/a)", "progressDetail": {"current": 1}}}
  1931      {"error": "Invalid..."}
  1932      ...
  1933  
  1934  If you wish to push an image on to a private registry, that image must already have a tag
  1935  into a repository which references that registry `hostname` and `port`.  This repository name should
  1936  then be used in the URL. This duplicates the command line's flow.
  1937  
  1938  The push is cancelled if the HTTP connection is closed.
  1939  
  1940  **Example request**:
  1941  
  1942      POST /images/registry.acme.com:5000/test/push HTTP/1.1
  1943  
  1944  
  1945  Query Parameters:
  1946  
  1947  -   **tag** – The tag to associate with the image on the registry. This is optional.
  1948  
  1949  Request Headers:
  1950  
  1951  -   **X-Registry-Auth** – base64-encoded AuthConfig object, containing either login information, or a token
  1952      - Credential based login:
  1953  
  1954          ```
  1955      {
  1956              "username": "jdoe",
  1957              "password": "secret",
  1958              "email": "jdoe@acme.com",
  1959      }
  1960          ```
  1961  
  1962      - Token based login:
  1963  
  1964          ```
  1965      {
  1966              "registrytoken": "9cbaf023786cd7..."
  1967      }
  1968          ```
  1969  
  1970  Status Codes:
  1971  
  1972  -   **200** – no error
  1973  -   **404** – no such image
  1974  -   **500** – server error
  1975  
  1976  ### Tag an image into a repository
  1977  
  1978  `POST /images/(name)/tag`
  1979  
  1980  Tag the image `name` into a repository
  1981  
  1982  **Example request**:
  1983  
  1984      POST /images/test/tag?repo=myrepo&force=0&tag=v42 HTTP/1.1
  1985  
  1986  **Example response**:
  1987  
  1988      HTTP/1.1 201 Created
  1989  
  1990  Query Parameters:
  1991  
  1992  -   **repo** – The repository to tag in
  1993  -   **force** – 1/True/true or 0/False/false, default false
  1994  -   **tag** - The new tag name
  1995  
  1996  Status Codes:
  1997  
  1998  -   **201** – no error
  1999  -   **400** – bad parameter
  2000  -   **404** – no such image
  2001  -   **409** – conflict
  2002  -   **500** – server error
  2003  
  2004  ### Remove an image
  2005  
  2006  `DELETE /images/(name)`
  2007  
  2008  Remove the image `name` from the filesystem
  2009  
  2010  **Example request**:
  2011  
  2012      DELETE /images/test HTTP/1.1
  2013  
  2014  **Example response**:
  2015  
  2016      HTTP/1.1 200 OK
  2017      Content-type: application/json
  2018  
  2019      [
  2020       {"Untagged": "3e2f21a89f"},
  2021       {"Deleted": "3e2f21a89f"},
  2022       {"Deleted": "53b4f83ac9"}
  2023      ]
  2024  
  2025  Query Parameters:
  2026  
  2027  -   **force** – 1/True/true or 0/False/false, default false
  2028  -   **noprune** – 1/True/true or 0/False/false, default false
  2029  
  2030  Status Codes:
  2031  
  2032  -   **200** – no error
  2033  -   **404** – no such image
  2034  -   **409** – conflict
  2035  -   **500** – server error
  2036  
  2037  ### Search images
  2038  
  2039  `GET /images/search`
  2040  
  2041  Search for an image on [Docker Hub](https://hub.docker.com).
  2042  
  2043  > **Note**:
  2044  > The response keys have changed from API v1.6 to reflect the JSON
  2045  > sent by the registry server to the docker daemon's request.
  2046  
  2047  **Example request**:
  2048  
  2049      GET /images/search?term=sshd HTTP/1.1
  2050  
  2051  **Example response**:
  2052  
  2053      HTTP/1.1 200 OK
  2054      Content-Type: application/json
  2055  
  2056      [
  2057              {
  2058                  "description": "",
  2059                  "is_official": false,
  2060                  "is_automated": false,
  2061                  "name": "wma55/u1210sshd",
  2062                  "star_count": 0
  2063              },
  2064              {
  2065                  "description": "",
  2066                  "is_official": false,
  2067                  "is_automated": false,
  2068                  "name": "jdswinbank/sshd",
  2069                  "star_count": 0
  2070              },
  2071              {
  2072                  "description": "",
  2073                  "is_official": false,
  2074                  "is_automated": false,
  2075                  "name": "vgauthier/sshd",
  2076                  "star_count": 0
  2077              }
  2078      ...
  2079      ]
  2080  
  2081  Query Parameters:
  2082  
  2083  -   **term** – term to search
  2084  
  2085  Status Codes:
  2086  
  2087  -   **200** – no error
  2088  -   **500** – server error
  2089  
  2090  ## 2.3 Misc
  2091  
  2092  ### Check auth configuration
  2093  
  2094  `POST /auth`
  2095  
  2096  Get the default username and email
  2097  
  2098  **Example request**:
  2099  
  2100      POST /auth HTTP/1.1
  2101      Content-Type: application/json
  2102  
  2103      {
  2104           "username":" hannibal",
  2105           "password: "xxxx",
  2106           "email": "hannibal@a-team.com",
  2107           "serveraddress": "https://index.docker.io/v1/"
  2108      }
  2109  
  2110  **Example response**:
  2111  
  2112      HTTP/1.1 200 OK
  2113  
  2114  Status Codes:
  2115  
  2116  -   **200** – no error
  2117  -   **204** – no error
  2118  -   **500** – server error
  2119  
  2120  ### Display system-wide information
  2121  
  2122  `GET /info`
  2123  
  2124  Display system-wide information
  2125  
  2126  **Example request**:
  2127  
  2128      GET /info HTTP/1.1
  2129  
  2130  **Example response**:
  2131  
  2132      HTTP/1.1 200 OK
  2133      Content-Type: application/json
  2134  
  2135      {
  2136          "Architecture": "x86_64",
  2137          "ClusterStore": "etcd://localhost:2379",
  2138          "Containers": 11,
  2139          "ContainersRunning": 7,
  2140          "ContainersStopped": 3,
  2141          "ContainersPaused": 1,
  2142          "CpuCfsPeriod": true,
  2143          "CpuCfsQuota": true,
  2144          "Debug": false,
  2145          "DockerRootDir": "/var/lib/docker",
  2146          "Driver": "btrfs",
  2147          "DriverStatus": [[""]],
  2148          "ExecutionDriver": "native-0.1",
  2149          "ExperimentalBuild": false,
  2150          "HttpProxy": "http://test:test@localhost:8080",
  2151          "HttpsProxy": "https://test:test@localhost:8080",
  2152          "ID": "7TRN:IPZB:QYBB:VPBQ:UMPP:KARE:6ZNR:XE6T:7EWV:PKF4:ZOJD:TPYS",
  2153          "IPv4Forwarding": true,
  2154          "Images": 16,
  2155          "IndexServerAddress": "https://index.docker.io/v1/",
  2156          "InitPath": "/usr/bin/docker",
  2157          "InitSha1": "",
  2158          "KernelVersion": "3.12.0-1-amd64",
  2159          "Labels": [
  2160              "storage=ssd"
  2161          ],
  2162          "MemTotal": 2099236864,
  2163          "MemoryLimit": true,
  2164          "NCPU": 1,
  2165          "NEventsListener": 0,
  2166          "NFd": 11,
  2167          "NGoroutines": 21,
  2168          "Name": "prod-server-42",
  2169          "NoProxy": "9.81.1.160",
  2170          "OomKillDisable": true,
  2171          "OSType": "linux",
  2172          "OperatingSystem": "Boot2Docker",
  2173          "Plugins": {
  2174              "Volume": [
  2175                  "local"
  2176              ],
  2177              "Network": [
  2178                  "null",
  2179                  "host",
  2180                  "bridge"
  2181              ]
  2182          },
  2183          "RegistryConfig": {
  2184              "IndexConfigs": {
  2185                  "docker.io": {
  2186                      "Mirrors": null,
  2187                      "Name": "docker.io",
  2188                      "Official": true,
  2189                      "Secure": true
  2190                  }
  2191              },
  2192              "InsecureRegistryCIDRs": [
  2193                  "127.0.0.0/8"
  2194              ]
  2195          },
  2196          "ServerVersion": "1.9.0",
  2197          "SwapLimit": false,
  2198          "SystemStatus": [["State", "Healthy"]],
  2199          "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
  2200      }
  2201  
  2202  Status Codes:
  2203  
  2204  -   **200** – no error
  2205  -   **500** – server error
  2206  
  2207  ### Show the docker version information
  2208  
  2209  `GET /version`
  2210  
  2211  Show the docker version information
  2212  
  2213  **Example request**:
  2214  
  2215      GET /version HTTP/1.1
  2216  
  2217  **Example response**:
  2218  
  2219      HTTP/1.1 200 OK
  2220      Content-Type: application/json
  2221  
  2222      {
  2223           "Version": "1.10.0-dev",
  2224           "Os": "linux",
  2225           "KernelVersion": "3.19.0-23-generic",
  2226           "GoVersion": "go1.4.2",
  2227           "GitCommit": "e75da4b",
  2228           "Arch": "amd64",
  2229           "ApiVersion": "1.22",
  2230           "BuildTime": "2015-12-01T07:09:13.444803460+00:00",
  2231           "Experimental": true
  2232      }
  2233  
  2234  Status Codes:
  2235  
  2236  -   **200** – no error
  2237  -   **500** – server error
  2238  
  2239  ### Ping the docker server
  2240  
  2241  `GET /_ping`
  2242  
  2243  Ping the docker server
  2244  
  2245  **Example request**:
  2246  
  2247      GET /_ping HTTP/1.1
  2248  
  2249  **Example response**:
  2250  
  2251      HTTP/1.1 200 OK
  2252      Content-Type: text/plain
  2253  
  2254      OK
  2255  
  2256  Status Codes:
  2257  
  2258  -   **200** - no error
  2259  -   **500** - server error
  2260  
  2261  ### Create a new image from a container's changes
  2262  
  2263  `POST /commit`
  2264  
  2265  Create a new image from a container's changes
  2266  
  2267  **Example request**:
  2268  
  2269      POST /commit?container=44c004db4b17&comment=message&repo=myrepo HTTP/1.1
  2270      Content-Type: application/json
  2271  
  2272      {
  2273           "Hostname": "",
  2274           "Domainname": "",
  2275           "User": "",
  2276           "AttachStdin": false,
  2277           "AttachStdout": true,
  2278           "AttachStderr": true,
  2279           "Tty": false,
  2280           "OpenStdin": false,
  2281           "StdinOnce": false,
  2282           "Env": null,
  2283           "Cmd": [
  2284                   "date"
  2285           ],
  2286           "Mounts": [
  2287             {
  2288               "Source": "/data",
  2289               "Destination": "/data",
  2290               "Mode": "ro,Z",
  2291               "RW": false
  2292             }
  2293           ],
  2294           "Labels": {
  2295                   "key1": "value1",
  2296                   "key2": "value2"
  2297            },
  2298           "WorkingDir": "",
  2299           "NetworkDisabled": false,
  2300           "ExposedPorts": {
  2301                   "22/tcp": {}
  2302           }
  2303      }
  2304  
  2305  **Example response**:
  2306  
  2307      HTTP/1.1 201 Created
  2308      Content-Type: application/json
  2309  
  2310      {"Id": "596069db4bf5"}
  2311  
  2312  Json Parameters:
  2313  
  2314  -  **config** - the container's configuration
  2315  
  2316  Query Parameters:
  2317  
  2318  -   **container** – source container
  2319  -   **repo** – repository
  2320  -   **tag** – tag
  2321  -   **comment** – commit message
  2322  -   **author** – author (e.g., "John Hannibal Smith
  2323      <[hannibal@a-team.com](mailto:hannibal%40a-team.com)>")
  2324  -   **pause** – 1/True/true or 0/False/false, whether to pause the container before committing
  2325  -   **changes** – Dockerfile instructions to apply while committing
  2326  
  2327  Status Codes:
  2328  
  2329  -   **201** – no error
  2330  -   **404** – no such container
  2331  -   **500** – server error
  2332  
  2333  ### Monitor Docker's events
  2334  
  2335  `GET /events`
  2336  
  2337  Get container events from docker, either in real time via streaming, or via polling (using since).
  2338  
  2339  Docker containers report the following events:
  2340  
  2341      attach, commit, copy, create, destroy, die, exec_create, exec_start, export, kill, oom, pause, rename, resize, restart, start, stop, top, unpause, update
  2342  
  2343  Docker images report the following events:
  2344  
  2345      delete, import, pull, push, tag, untag
  2346  
  2347  Docker volumes report the following events:
  2348  
  2349      create, mount, unmount, destroy
  2350  
  2351  Docker networks report the following events:
  2352  
  2353      create, connect, disconnect, destroy
  2354  
  2355  **Example request**:
  2356  
  2357      GET /events?since=1374067924
  2358  
  2359  **Example response**:
  2360  
  2361      HTTP/1.1 200 OK
  2362      Content-Type: application/json
  2363  
  2364      [
  2365  	    {
  2366  		"action": "pull",
  2367  		"type": "image",
  2368  		"actor": {
  2369  			"id": "busybox:latest",
  2370  			"attributes": {}
  2371  		}
  2372  		"time": 1442421700,
  2373  		"timeNano": 1442421700598988358
  2374  	    },
  2375              {
  2376  		"action": "create",
  2377  		"type": "container",
  2378  		"actor": {
  2379  			"id": "5745704abe9caa5",
  2380  			"attributes": {"image": "busybox"}
  2381  		}
  2382  		"time": 1442421716,
  2383  		"timeNano": 1442421716853979870
  2384  	    },
  2385              {
  2386  		"action": "attach",
  2387  		"type": "container",
  2388  		"actor": {
  2389  			"id": "5745704abe9caa5",
  2390  			"attributes": {"image": "busybox"}
  2391  		}
  2392  		"time": 1442421716,
  2393  		"timeNano": 1442421716894759198
  2394  	    },
  2395              {
  2396  		"action": "start",
  2397  		"type": "container",
  2398  		"actor": {
  2399  			"id": "5745704abe9caa5",
  2400  			"attributes": {"image": "busybox"}
  2401  		}
  2402  		"time": 1442421716,
  2403  		"timeNano": 1442421716983607193
  2404  	    }
  2405      ]
  2406  
  2407  Query Parameters:
  2408  
  2409  -   **since** – Timestamp used for polling
  2410  -   **until** – Timestamp used for polling
  2411  -   **filters** – A json encoded value of the filters (a map[string][]string) to process on the event list. Available filters:
  2412    -   `container=<string>`; -- container to filter
  2413    -   `event=<string>`; -- event to filter
  2414    -   `image=<string>`; -- image to filter
  2415    -   `label=<string>`; -- image and container label to filter
  2416    -   `type=<string>`; -- either `container` or `image` or `volume` or `network`
  2417    -   `volume=<string>`; -- volume to filter
  2418    -   `network=<string>`; -- network to filter
  2419  
  2420  Status Codes:
  2421  
  2422  -   **200** – no error
  2423  -   **500** – server error
  2424  
  2425  ### Get a tarball containing all images in a repository
  2426  
  2427  `GET /images/(name)/get`
  2428  
  2429  Get a tarball containing all images and metadata for the repository specified
  2430  by `name`.
  2431  
  2432  If `name` is a specific name and tag (e.g. ubuntu:latest), then only that image
  2433  (and its parents) are returned. If `name` is an image ID, similarly only that
  2434  image (and its parents) are returned, but with the exclusion of the
  2435  'repositories' file in the tarball, as there were no image names referenced.
  2436  
  2437  See the [image tarball format](#image-tarball-format) for more details.
  2438  
  2439  **Example request**
  2440  
  2441      GET /images/ubuntu/get
  2442  
  2443  **Example response**:
  2444  
  2445      HTTP/1.1 200 OK
  2446      Content-Type: application/x-tar
  2447  
  2448      Binary data stream
  2449  
  2450  Status Codes:
  2451  
  2452  -   **200** – no error
  2453  -   **500** – server error
  2454  
  2455  ### Get a tarball containing all images.
  2456  
  2457  `GET /images/get`
  2458  
  2459  Get a tarball containing all images and metadata for one or more repositories.
  2460  
  2461  For each value of the `names` parameter: if it is a specific name and tag (e.g.
  2462  `ubuntu:latest`), then only that image (and its parents) are returned; if it is
  2463  an image ID, similarly only that image (and its parents) are returned and there
  2464  would be no names referenced in the 'repositories' file for this image ID.
  2465  
  2466  See the [image tarball format](#image-tarball-format) for more details.
  2467  
  2468  **Example request**
  2469  
  2470      GET /images/get?names=myname%2Fmyapp%3Alatest&names=busybox
  2471  
  2472  **Example response**:
  2473  
  2474      HTTP/1.1 200 OK
  2475      Content-Type: application/x-tar
  2476  
  2477      Binary data stream
  2478  
  2479  Status Codes:
  2480  
  2481  -   **200** – no error
  2482  -   **500** – server error
  2483  
  2484  ### Load a tarball with a set of images and tags into docker
  2485  
  2486  `POST /images/load`
  2487  
  2488  Load a set of images and tags into a Docker repository.
  2489  See the [image tarball format](#image-tarball-format) for more details.
  2490  
  2491  **Example request**
  2492  
  2493      POST /images/load
  2494  
  2495      Tarball in body
  2496  
  2497  **Example response**:
  2498  
  2499      HTTP/1.1 200 OK
  2500  
  2501  Status Codes:
  2502  
  2503  -   **200** – no error
  2504  -   **500** – server error
  2505  
  2506  ### Image tarball format
  2507  
  2508  An image tarball contains one directory per image layer (named using its long ID),
  2509  each containing these files:
  2510  
  2511  - `VERSION`: currently `1.0` - the file format version
  2512  - `json`: detailed layer information, similar to `docker inspect layer_id`
  2513  - `layer.tar`: A tarfile containing the filesystem changes in this layer
  2514  
  2515  The `layer.tar` file contains `aufs` style `.wh..wh.aufs` files and directories
  2516  for storing attribute changes and deletions.
  2517  
  2518  If the tarball defines a repository, the tarball should also include a `repositories` file at
  2519  the root that contains a list of repository and tag names mapped to layer IDs.
  2520  
  2521  ```
  2522  {"hello-world":
  2523      {"latest": "565a9d68a73f6706862bfe8409a7f659776d4d60a8d096eb4a3cbce6999cc2a1"}
  2524  }
  2525  ```
  2526  
  2527  ### Exec Create
  2528  
  2529  `POST /containers/(id or name)/exec`
  2530  
  2531  Sets up an exec instance in a running container `id`
  2532  
  2533  **Example request**:
  2534  
  2535      POST /containers/e90e34656806/exec HTTP/1.1
  2536      Content-Type: application/json
  2537  
  2538        {
  2539         "AttachStdin": false,
  2540         "AttachStdout": true,
  2541         "AttachStderr": true,
  2542         "DetachKeys": "ctrl-p,ctrl-q",
  2543         "Tty": false,
  2544         "Cmd": [
  2545                       "date"
  2546               ]
  2547        }
  2548  
  2549  **Example response**:
  2550  
  2551      HTTP/1.1 201 Created
  2552      Content-Type: application/json
  2553  
  2554      {
  2555           "Id": "f90e34656806",
  2556           "Warnings":[]
  2557      }
  2558  
  2559  Json Parameters:
  2560  
  2561  -   **AttachStdin** - Boolean value, attaches to `stdin` of the `exec` command.
  2562  -   **AttachStdout** - Boolean value, attaches to `stdout` of the `exec` command.
  2563  -   **AttachStderr** - Boolean value, attaches to `stderr` of the `exec` command.
  2564  -   **DetachKeys** – Override the key sequence for detaching a
  2565          container. Format is a single character `[a-Z]` or `ctrl-<value>`
  2566          where `<value>` is one of: `a-z`, `@`, `^`, `[`, `,` or `_`.
  2567  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2568  -   **Cmd** - Command to run specified as a string or an array of strings.
  2569  
  2570  
  2571  Status Codes:
  2572  
  2573  -   **201** – no error
  2574  -   **404** – no such container
  2575  -   **409** - container is paused
  2576  -   **500** - server error
  2577  
  2578  ### Exec Start
  2579  
  2580  `POST /exec/(id)/start`
  2581  
  2582  Starts a previously set up `exec` instance `id`. If `detach` is true, this API
  2583  returns after starting the `exec` command. Otherwise, this API sets up an
  2584  interactive session with the `exec` command.
  2585  
  2586  **Example request**:
  2587  
  2588      POST /exec/e90e34656806/start HTTP/1.1
  2589      Content-Type: application/json
  2590  
  2591      {
  2592       "Detach": false,
  2593       "Tty": false
  2594      }
  2595  
  2596  **Example response**:
  2597  
  2598      HTTP/1.1 200 OK
  2599      Content-Type: application/vnd.docker.raw-stream
  2600  
  2601      {{ STREAM }}
  2602  
  2603  Json Parameters:
  2604  
  2605  -   **Detach** - Detach from the `exec` command.
  2606  -   **Tty** - Boolean value to allocate a pseudo-TTY.
  2607  
  2608  Status Codes:
  2609  
  2610  -   **200** – no error
  2611  -   **404** – no such exec instance
  2612  -   **409** - container is paused
  2613  
  2614      **Stream details**:
  2615      Similar to the stream behavior of `POST /containers/(id or name)/attach` API
  2616  
  2617  ### Exec Resize
  2618  
  2619  `POST /exec/(id)/resize`
  2620  
  2621  Resizes the `tty` session used by the `exec` command `id`.  The unit is number of characters.
  2622  This API is valid only if `tty` was specified as part of creating and starting the `exec` command.
  2623  
  2624  **Example request**:
  2625  
  2626      POST /exec/e90e34656806/resize?h=40&w=80 HTTP/1.1
  2627      Content-Type: text/plain
  2628  
  2629  **Example response**:
  2630  
  2631      HTTP/1.1 201 Created
  2632      Content-Type: text/plain
  2633  
  2634  Query Parameters:
  2635  
  2636  -   **h** – height of `tty` session
  2637  -   **w** – width
  2638  
  2639  Status Codes:
  2640  
  2641  -   **201** – no error
  2642  -   **404** – no such exec instance
  2643  
  2644  ### Exec Inspect
  2645  
  2646  `GET /exec/(id)/json`
  2647  
  2648  Return low-level information about the `exec` command `id`.
  2649  
  2650  **Example request**:
  2651  
  2652      GET /exec/11fb006128e8ceb3942e7c58d77750f24210e35f879dd204ac975c184b820b39/json HTTP/1.1
  2653  
  2654  **Example response**:
  2655  
  2656      HTTP/1.1 200 OK
  2657      Content-Type: application/json
  2658  
  2659      {
  2660          "CanRemove": false,
  2661          "ContainerID": "b53ee82b53a40c7dca428523e34f741f3abc51d9f297a14ff874bf761b995126",
  2662          "DetachKeys": "",
  2663          "ExitCode": 2,
  2664          "ID": "f33bbfb39f5b142420f4759b2348913bd4a8d1a6d7fd56499cb41a1bb91d7b3b",
  2665          "OpenStderr": true,
  2666          "OpenStdin": true,
  2667          "OpenStdout": true,
  2668          "ProcessConfig": {
  2669              "arguments": [
  2670                  "-c",
  2671                  "exit 2"
  2672              ],
  2673              "entrypoint": "sh",
  2674              "privileged": false,
  2675              "tty": true,
  2676              "user": "1000"
  2677          },
  2678          "Running": false
  2679      }
  2680  
  2681  Status Codes:
  2682  
  2683  -   **200** – no error
  2684  -   **404** – no such exec instance
  2685  -   **500** - server error
  2686  
  2687  ## 2.4 Volumes
  2688  
  2689  ### List volumes
  2690  
  2691  `GET /volumes`
  2692  
  2693  **Example request**:
  2694  
  2695      GET /volumes HTTP/1.1
  2696  
  2697  **Example response**:
  2698  
  2699      HTTP/1.1 200 OK
  2700      Content-Type: application/json
  2701  
  2702      {
  2703        "Volumes": [
  2704          {
  2705            "Name": "tardis",
  2706            "Driver": "local",
  2707            "Mountpoint": "/var/lib/docker/volumes/tardis"
  2708          }
  2709        ],
  2710        "Warnings": []
  2711      }
  2712  
  2713  Query Parameters:
  2714  
  2715  - **filters** - JSON encoded value of the filters (a `map[string][]string`) to process on the volumes list. There is one available filter: `dangling=true`
  2716  
  2717  Status Codes:
  2718  
  2719  -   **200** - no error
  2720  -   **500** - server error
  2721  
  2722  ### Create a volume
  2723  
  2724  `POST /volumes/create`
  2725  
  2726  Create a volume
  2727  
  2728  **Example request**:
  2729  
  2730      POST /volumes/create HTTP/1.1
  2731      Content-Type: application/json
  2732  
  2733      {
  2734        "Name": "tardis"
  2735      }
  2736  
  2737  **Example response**:
  2738  
  2739      HTTP/1.1 201 Created
  2740      Content-Type: application/json
  2741  
  2742      {
  2743        "Name": "tardis",
  2744        "Driver": "local",
  2745        "Mountpoint": "/var/lib/docker/volumes/tardis"
  2746      }
  2747  
  2748  Status Codes:
  2749  
  2750  - **201** - no error
  2751  - **500**  - server error
  2752  
  2753  JSON Parameters:
  2754  
  2755  - **Name** - The new volume's name. If not specified, Docker generates a name.
  2756  - **Driver** - Name of the volume driver to use. Defaults to `local` for the name.
  2757  - **DriverOpts** - A mapping of driver options and values. These options are
  2758      passed directly to the driver and are driver specific.
  2759  
  2760  ### Inspect a volume
  2761  
  2762  `GET /volumes/(name)`
  2763  
  2764  Return low-level information on the volume `name`
  2765  
  2766  **Example request**:
  2767  
  2768      GET /volumes/tardis
  2769  
  2770  **Example response**:
  2771  
  2772      HTTP/1.1 200 OK
  2773      Content-Type: application/json
  2774  
  2775      {
  2776        "Name": "tardis",
  2777        "Driver": "local",
  2778        "Mountpoint": "/var/lib/docker/volumes/tardis"
  2779      }
  2780  
  2781  Status Codes:
  2782  
  2783  -   **200** - no error
  2784  -   **404** - no such volume
  2785  -   **500** - server error
  2786  
  2787  ### Remove a volume
  2788  
  2789  `DELETE /volumes/(name)`
  2790  
  2791  Instruct the driver to remove the volume (`name`).
  2792  
  2793  **Example request**:
  2794  
  2795      DELETE /volumes/tardis HTTP/1.1
  2796  
  2797  **Example response**:
  2798  
  2799      HTTP/1.1 204 No Content
  2800  
  2801  Status Codes
  2802  
  2803  -   **204** - no error
  2804  -   **404** - no such volume or volume driver
  2805  -   **409** - volume is in use and cannot be removed
  2806  -   **500** - server error
  2807  
  2808  ## 2.5 Networks
  2809  
  2810  ### List networks
  2811  
  2812  `GET /networks`
  2813  
  2814  **Example request**:
  2815  
  2816      GET /networks?filters={"type":{"custom":true}} HTTP/1.1
  2817  
  2818  **Example response**:
  2819  
  2820  ```
  2821  HTTP/1.1 200 OK
  2822  Content-Type: application/json
  2823  
  2824  [
  2825    {
  2826      "Name": "bridge",
  2827      "Id": "f2de39df4171b0dc801e8002d1d999b77256983dfc63041c0f34030aa3977566",
  2828      "Scope": "local",
  2829      "Driver": "bridge",
  2830      "IPAM": {
  2831        "Driver": "default",
  2832        "Config": [
  2833          {
  2834            "Subnet": "172.17.0.0/16"
  2835          }
  2836        ]
  2837      },
  2838      "Containers": {
  2839        "39b69226f9d79f5634485fb236a23b2fe4e96a0a94128390a7fbbcc167065867": {
  2840          "EndpointID": "ed2419a97c1d9954d05b46e462e7002ea552f216e9b136b80a7db8d98b442eda",
  2841          "MacAddress": "02:42:ac:11:00:02",
  2842          "IPv4Address": "172.17.0.2/16",
  2843          "IPv6Address": ""
  2844        }
  2845      },
  2846      "Options": {
  2847        "com.docker.network.bridge.default_bridge": "true",
  2848        "com.docker.network.bridge.enable_icc": "true",
  2849        "com.docker.network.bridge.enable_ip_masquerade": "true",
  2850        "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
  2851        "com.docker.network.bridge.name": "docker0",
  2852        "com.docker.network.driver.mtu": "1500"
  2853      }
  2854    },
  2855    {
  2856      "Name": "none",
  2857      "Id": "e086a3893b05ab69242d3c44e49483a3bbbd3a26b46baa8f61ab797c1088d794",
  2858      "Scope": "local",
  2859      "Driver": "null",
  2860      "IPAM": {
  2861        "Driver": "default",
  2862        "Config": []
  2863      },
  2864      "Containers": {},
  2865      "Options": {}
  2866    },
  2867    {
  2868      "Name": "host",
  2869      "Id": "13e871235c677f196c4e1ecebb9dc733b9b2d2ab589e30c539efeda84a24215e",
  2870      "Scope": "local",
  2871      "Driver": "host",
  2872      "IPAM": {
  2873        "Driver": "default",
  2874        "Config": []
  2875      },
  2876      "Containers": {},
  2877      "Options": {}
  2878    }
  2879  ]
  2880  ```
  2881  
  2882  Query Parameters:
  2883  
  2884  - **filters** - JSON encoded network list filter. The filter value is one of:
  2885    -   `name=<network-name>` Matches all or part of a network name.
  2886    -   `id=<network-id>` Matches all or part of a network id.
  2887    -   `type=["custom"|"builtin"]` Filters networks by type. The `custom` keyword returns all user-defined networks.
  2888  
  2889  Status Codes:
  2890  
  2891  -   **200** - no error
  2892  -   **500** - server error
  2893  
  2894  ### Inspect network
  2895  
  2896  `GET /networks/<network-id>`
  2897  
  2898  **Example request**:
  2899  
  2900      GET /networks/7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99 HTTP/1.1
  2901  
  2902  **Example response**:
  2903  
  2904  ```
  2905  HTTP/1.1 200 OK
  2906  Content-Type: application/json
  2907  
  2908  {
  2909    "Name": "net01",
  2910    "Id": "7d86d31b1478e7cca9ebed7e73aa0fdeec46c5ca29497431d3007d2d9e15ed99",
  2911    "Scope": "local",
  2912    "Driver": "bridge",
  2913    "IPAM": {
  2914      "Driver": "default",
  2915      "Config": [
  2916        {
  2917          "Subnet": "172.19.0.0/16",
  2918          "Gateway": "172.19.0.1/16"
  2919        }
  2920      ],
  2921      "Options": {
  2922          "foo": "bar"
  2923      }
  2924    },
  2925    "Containers": {
  2926      "19a4d5d687db25203351ed79d478946f861258f018fe384f229f2efa4b23513c": {
  2927        "Name": "test",
  2928        "EndpointID": "628cadb8bcb92de107b2a1e516cbffe463e321f548feb37697cce00ad694f21a",
  2929        "MacAddress": "02:42:ac:13:00:02",
  2930        "IPv4Address": "172.19.0.2/16",
  2931        "IPv6Address": ""
  2932      }
  2933    },
  2934    "Options": {
  2935      "com.docker.network.bridge.default_bridge": "true",
  2936      "com.docker.network.bridge.enable_icc": "true",
  2937      "com.docker.network.bridge.enable_ip_masquerade": "true",
  2938      "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
  2939      "com.docker.network.bridge.name": "docker0",
  2940      "com.docker.network.driver.mtu": "1500"
  2941    }
  2942  }
  2943  ```
  2944  
  2945  Status Codes:
  2946  
  2947  -   **200** - no error
  2948  -   **404** - network not found
  2949  
  2950  ### Create a network
  2951  
  2952  `POST /networks/create`
  2953  
  2954  Create a network
  2955  
  2956  **Example request**:
  2957  
  2958  ```
  2959  POST /networks/create HTTP/1.1
  2960  Content-Type: application/json
  2961  
  2962  {
  2963    "Name":"isolated_nw",
  2964    "Driver":"bridge",
  2965    "IPAM":{
  2966      "Config":[
  2967         {
  2968            "Subnet":"172.20.0.0/16",
  2969            "IPRange":"172.20.10.0/24",
  2970            "Gateway":"172.20.10.11"
  2971          },
  2972          {
  2973            "Subnet":"2001:db8:abcd::/64",
  2974            "Gateway":"2001:db8:abcd::1011"
  2975          }
  2976      ],
  2977      "Options": {
  2978          "foo": "bar"
  2979      }
  2980    },
  2981    "Internal":true
  2982  }
  2983  ```
  2984  
  2985  **Example response**:
  2986  
  2987  ```
  2988  HTTP/1.1 201 Created
  2989  Content-Type: application/json
  2990  
  2991  {
  2992    "Id": "22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30",
  2993    "Warning": ""
  2994  }
  2995  ```
  2996  
  2997  Status Codes:
  2998  
  2999  - **201** - no error
  3000  - **404** - plugin not found
  3001  - **500** - server error
  3002  
  3003  JSON Parameters:
  3004  
  3005  - **Name** - The new network's name. this is a mandatory field
  3006  - **Driver** - Name of the network driver plugin to use. Defaults to `bridge` driver
  3007  - **IPAM** - Optional custom IP scheme for the network
  3008  - **Options** - Network specific options to be used by the drivers
  3009  - **CheckDuplicate** - Requests daemon to check for networks with same name
  3010  
  3011  ### Connect a container to a network
  3012  
  3013  `POST /networks/(id)/connect`
  3014  
  3015  Connect a container to a network
  3016  
  3017  **Example request**:
  3018  
  3019  ```
  3020  POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/connect HTTP/1.1
  3021  Content-Type: application/json
  3022  
  3023  {
  3024    "Container":"3613f73ba0e4",
  3025    "EndpointConfig": {
  3026      "IPAMConfig": {
  3027          "IPv4Address":"172.24.56.89",
  3028          "IPv6Address":"2001:db8::5689"
  3029      }
  3030    }
  3031  }
  3032  ```
  3033  
  3034  **Example response**:
  3035  
  3036      HTTP/1.1 200 OK
  3037  
  3038  Status Codes:
  3039  
  3040  - **200** - no error
  3041  - **404** - network or container is not found
  3042  - **500** - Internal Server Error
  3043  
  3044  JSON Parameters:
  3045  
  3046  - **container** - container-id/name to be connected to the network
  3047  
  3048  ### Disconnect a container from a network
  3049  
  3050  `POST /networks/(id)/disconnect`
  3051  
  3052  Disconnect a container from a network
  3053  
  3054  **Example request**:
  3055  
  3056  ```
  3057  POST /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30/disconnect HTTP/1.1
  3058  Content-Type: application/json
  3059  
  3060  {
  3061    "Container":"3613f73ba0e4",
  3062    "Force":false
  3063  }
  3064  ```
  3065  
  3066  **Example response**:
  3067  
  3068      HTTP/1.1 200 OK
  3069  
  3070  Status Codes:
  3071  
  3072  - **200** - no error
  3073  - **404** - network or container not found
  3074  - **500** - Internal Server Error
  3075  
  3076  JSON Parameters:
  3077  
  3078  - **Container** - container-id/name to be disconnected from a network
  3079  - **Force** - Force the container to disconnect from a network
  3080  
  3081  ### Remove a network
  3082  
  3083  `DELETE /networks/(id)`
  3084  
  3085  Instruct the driver to remove the network (`id`).
  3086  
  3087  **Example request**:
  3088  
  3089      DELETE /networks/22be93d5babb089c5aab8dbc369042fad48ff791584ca2da2100db837a1c7c30 HTTP/1.1
  3090  
  3091  **Example response**:
  3092  
  3093      HTTP/1.1 200 OK
  3094  
  3095  Status Codes
  3096  
  3097  -   **200** - no error
  3098  -   **404** - no such network
  3099  -   **500** - server error
  3100  
  3101  # 3. Going further
  3102  
  3103  ## 3.1 Inside `docker run`
  3104  
  3105  As an example, the `docker run` command line makes the following API calls:
  3106  
  3107  - Create the container
  3108  
  3109  - If the status code is 404, it means the image doesn't exist:
  3110      - Try to pull it.
  3111      - Then, retry to create the container.
  3112  
  3113  - Start the container.
  3114  
  3115  - If you are not in detached mode:
  3116  - Attach to the container, using `logs=1` (to have `stdout` and
  3117        `stderr` from the container's start) and `stream=1`
  3118  
  3119  - If in detached mode or only `stdin` is attached, display the container's id.
  3120  
  3121  ## 3.2 Hijacking
  3122  
  3123  In this version of the API, `/attach`, uses hijacking to transport `stdin`,
  3124  `stdout`, and `stderr` on the same socket.
  3125  
  3126  To hint potential proxies about connection hijacking, Docker client sends
  3127  connection upgrade headers similarly to websocket.
  3128  
  3129      Upgrade: tcp
  3130      Connection: Upgrade
  3131  
  3132  When Docker daemon detects the `Upgrade` header, it switches its status code
  3133  from **200 OK** to **101 UPGRADED** and resends the same headers.
  3134  
  3135  
  3136  ## 3.3 CORS Requests
  3137  
  3138  To set cross origin requests to the remote api please give values to
  3139  `--api-cors-header` when running Docker in daemon mode. Set * (asterisk) allows all,
  3140  default or blank means CORS disabled
  3141  
  3142      $ docker daemon -H="192.168.1.9:2375" --api-cors-header="http://foo.bar"