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