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