github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/docs/reference/api/docker_remote_api_v1.23.md (about)

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