github.com/SophiaGitHub/hello@v1.7.1-rc3/docs/reference/api/docker_remote_api_v1.19.md (about)

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