github.com/endocode/docker@v1.4.2-0.20160113120958-46eb4700391e/docs/reference/api/docker_remote_api_v1.21.md (about)

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