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