| ... | ... |
@@ -17,7 +17,7 @@ import ( |
| 17 | 17 |
"strings" |
| 18 | 18 |
) |
| 19 | 19 |
|
| 20 |
-const APIVERSION = 1.3 |
|
| 20 |
+const APIVERSION = 1.4 |
|
| 21 | 21 |
const DEFAULTHTTPHOST string = "127.0.0.1" |
| 22 | 22 |
const DEFAULTHTTPPORT int = 4243 |
| 23 | 23 |
|
| ... | ... |
@@ -252,6 +252,9 @@ func getContainersChanges(srv *Server, version float64, w http.ResponseWriter, r |
| 252 | 252 |
} |
| 253 | 253 |
|
| 254 | 254 |
func getContainersTop(srv *Server, version float64, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
| 255 |
+ if version < 1.4 {
|
|
| 256 |
+ return fmt.Errorf("top was improved a lot since 1.3, Please upgrade your docker client.")
|
|
| 257 |
+ } |
|
| 255 | 258 |
if vars == nil {
|
| 256 | 259 |
return fmt.Errorf("Missing parameter")
|
| 257 | 260 |
} |
| ... | ... |
@@ -19,8 +19,8 @@ Docker Remote API |
| 19 | 19 |
2. Versions |
| 20 | 20 |
=========== |
| 21 | 21 |
|
| 22 |
-The current verson of the API is 1.3 |
|
| 23 |
-Calling /images/<name>/insert is the same as calling /v1.3/images/<name>/insert |
|
| 22 |
+The current verson of the API is 1.4 |
|
| 23 |
+Calling /images/<name>/insert is the same as calling /v1.4/images/<name>/insert |
|
| 24 | 24 |
You can still call an old version of the api using /v1.0/images/<name>/insert |
| 25 | 25 |
|
| 26 | 26 |
:doc:`docker_remote_api_v1.3` |
| ... | ... |
@@ -31,6 +31,18 @@ What's new |
| 31 | 31 |
|
| 32 | 32 |
Listing processes (/top): |
| 33 | 33 |
|
| 34 |
+- You can now use ps args with docker top, like `docker top <container_id> aux` |
|
| 35 |
+ |
|
| 36 |
+:doc:`docker_remote_api_v1.3` |
|
| 37 |
+***************************** |
|
| 38 |
+ |
|
| 39 |
+docker v0.5.0 51f6c4a_ |
|
| 40 |
+ |
|
| 41 |
+What's new |
|
| 42 |
+---------- |
|
| 43 |
+ |
|
| 44 |
+Listing processes (/top): |
|
| 45 |
+ |
|
| 34 | 46 |
- List the processes inside a container |
| 35 | 47 |
|
| 36 | 48 |
|
| ... | ... |
@@ -109,6 +121,7 @@ Initial version |
| 109 | 109 |
.. _a8ae398: https://github.com/dotcloud/docker/commit/a8ae398bf52e97148ee7bd0d5868de2e15bd297f |
| 110 | 110 |
.. _8d73740: https://github.com/dotcloud/docker/commit/8d73740343778651c09160cde9661f5f387b36f4 |
| 111 | 111 |
.. _2e7649b: https://github.com/dotcloud/docker/commit/2e7649beda7c820793bd46766cbc2cfeace7b168 |
| 112 |
+.. _51f6c4a: https://github.com/dotcloud/docker/commit/51f6c4a7372450d164c61e0054daf0223ddbd909 |
|
| 112 | 113 |
|
| 113 | 114 |
================================== |
| 114 | 115 |
Docker Remote API Client Libraries |
| 115 | 116 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,1093 @@ |
| 0 |
+:title: Remote API v1.3 |
|
| 1 |
+:description: API Documentation for Docker |
|
| 2 |
+:keywords: API, Docker, rcli, REST, documentation |
|
| 3 |
+ |
|
| 4 |
+====================== |
|
| 5 |
+Docker Remote API v1.3 |
|
| 6 |
+====================== |
|
| 7 |
+ |
|
| 8 |
+.. contents:: Table of Contents |
|
| 9 |
+ |
|
| 10 |
+1. Brief introduction |
|
| 11 |
+===================== |
|
| 12 |
+ |
|
| 13 |
+- The Remote API is replacing rcli |
|
| 14 |
+- Default port in the docker deamon is 4243 |
|
| 15 |
+- The API tends to be REST, but for some complex commands, like attach or pull, the HTTP connection is hijacked to transport stdout stdin and stderr |
|
| 16 |
+ |
|
| 17 |
+2. Endpoints |
|
| 18 |
+============ |
|
| 19 |
+ |
|
| 20 |
+2.1 Containers |
|
| 21 |
+-------------- |
|
| 22 |
+ |
|
| 23 |
+List containers |
|
| 24 |
+*************** |
|
| 25 |
+ |
|
| 26 |
+.. http:get:: /containers/json |
|
| 27 |
+ |
|
| 28 |
+ List containers |
|
| 29 |
+ |
|
| 30 |
+ **Example request**: |
|
| 31 |
+ |
|
| 32 |
+ .. sourcecode:: http |
|
| 33 |
+ |
|
| 34 |
+ GET /containers/json?all=1&before=8dfafdbc3a40&size=1 HTTP/1.1 |
|
| 35 |
+ |
|
| 36 |
+ **Example response**: |
|
| 37 |
+ |
|
| 38 |
+ .. sourcecode:: http |
|
| 39 |
+ |
|
| 40 |
+ HTTP/1.1 200 OK |
|
| 41 |
+ Content-Type: application/json |
|
| 42 |
+ |
|
| 43 |
+ [ |
|
| 44 |
+ {
|
|
| 45 |
+ "Id": "8dfafdbc3a40", |
|
| 46 |
+ "Image": "base:latest", |
|
| 47 |
+ "Command": "echo 1", |
|
| 48 |
+ "Created": 1367854155, |
|
| 49 |
+ "Status": "Exit 0", |
|
| 50 |
+ "Ports":"", |
|
| 51 |
+ "SizeRw":12288, |
|
| 52 |
+ "SizeRootFs":0 |
|
| 53 |
+ }, |
|
| 54 |
+ {
|
|
| 55 |
+ "Id": "9cd87474be90", |
|
| 56 |
+ "Image": "base:latest", |
|
| 57 |
+ "Command": "echo 222222", |
|
| 58 |
+ "Created": 1367854155, |
|
| 59 |
+ "Status": "Exit 0", |
|
| 60 |
+ "Ports":"", |
|
| 61 |
+ "SizeRw":12288, |
|
| 62 |
+ "SizeRootFs":0 |
|
| 63 |
+ }, |
|
| 64 |
+ {
|
|
| 65 |
+ "Id": "3176a2479c92", |
|
| 66 |
+ "Image": "base:latest", |
|
| 67 |
+ "Command": "echo 3333333333333333", |
|
| 68 |
+ "Created": 1367854154, |
|
| 69 |
+ "Status": "Exit 0", |
|
| 70 |
+ "Ports":"", |
|
| 71 |
+ "SizeRw":12288, |
|
| 72 |
+ "SizeRootFs":0 |
|
| 73 |
+ }, |
|
| 74 |
+ {
|
|
| 75 |
+ "Id": "4cb07b47f9fb", |
|
| 76 |
+ "Image": "base:latest", |
|
| 77 |
+ "Command": "echo 444444444444444444444444444444444", |
|
| 78 |
+ "Created": 1367854152, |
|
| 79 |
+ "Status": "Exit 0", |
|
| 80 |
+ "Ports":"", |
|
| 81 |
+ "SizeRw":12288, |
|
| 82 |
+ "SizeRootFs":0 |
|
| 83 |
+ } |
|
| 84 |
+ ] |
|
| 85 |
+ |
|
| 86 |
+ :query all: 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default |
|
| 87 |
+ :query limit: Show ``limit`` last created containers, include non-running ones. |
|
| 88 |
+ :query since: Show only containers created since Id, include non-running ones. |
|
| 89 |
+ :query before: Show only containers created before Id, include non-running ones. |
|
| 90 |
+ :query size: 1/True/true or 0/False/false, Show the containers sizes |
|
| 91 |
+ :statuscode 200: no error |
|
| 92 |
+ :statuscode 400: bad parameter |
|
| 93 |
+ :statuscode 500: server error |
|
| 94 |
+ |
|
| 95 |
+ |
|
| 96 |
+Create a container |
|
| 97 |
+****************** |
|
| 98 |
+ |
|
| 99 |
+.. http:post:: /containers/create |
|
| 100 |
+ |
|
| 101 |
+ Create a container |
|
| 102 |
+ |
|
| 103 |
+ **Example request**: |
|
| 104 |
+ |
|
| 105 |
+ .. sourcecode:: http |
|
| 106 |
+ |
|
| 107 |
+ POST /containers/create HTTP/1.1 |
|
| 108 |
+ Content-Type: application/json |
|
| 109 |
+ |
|
| 110 |
+ {
|
|
| 111 |
+ "Hostname":"", |
|
| 112 |
+ "User":"", |
|
| 113 |
+ "Memory":0, |
|
| 114 |
+ "MemorySwap":0, |
|
| 115 |
+ "AttachStdin":false, |
|
| 116 |
+ "AttachStdout":true, |
|
| 117 |
+ "AttachStderr":true, |
|
| 118 |
+ "PortSpecs":null, |
|
| 119 |
+ "Tty":false, |
|
| 120 |
+ "OpenStdin":false, |
|
| 121 |
+ "StdinOnce":false, |
|
| 122 |
+ "Env":null, |
|
| 123 |
+ "Cmd":[ |
|
| 124 |
+ "date" |
|
| 125 |
+ ], |
|
| 126 |
+ "Dns":null, |
|
| 127 |
+ "Image":"base", |
|
| 128 |
+ "Volumes":{},
|
|
| 129 |
+ "VolumesFrom":"" |
|
| 130 |
+ } |
|
| 131 |
+ |
|
| 132 |
+ **Example response**: |
|
| 133 |
+ |
|
| 134 |
+ .. sourcecode:: http |
|
| 135 |
+ |
|
| 136 |
+ HTTP/1.1 201 OK |
|
| 137 |
+ Content-Type: application/json |
|
| 138 |
+ |
|
| 139 |
+ {
|
|
| 140 |
+ "Id":"e90e34656806" |
|
| 141 |
+ "Warnings":[] |
|
| 142 |
+ } |
|
| 143 |
+ |
|
| 144 |
+ :jsonparam config: the container's configuration |
|
| 145 |
+ :statuscode 201: no error |
|
| 146 |
+ :statuscode 404: no such container |
|
| 147 |
+ :statuscode 406: impossible to attach (container not running) |
|
| 148 |
+ :statuscode 500: server error |
|
| 149 |
+ |
|
| 150 |
+ |
|
| 151 |
+Inspect a container |
|
| 152 |
+******************* |
|
| 153 |
+ |
|
| 154 |
+.. http:get:: /containers/(id)/json |
|
| 155 |
+ |
|
| 156 |
+ Return low-level information on the container ``id`` |
|
| 157 |
+ |
|
| 158 |
+ **Example request**: |
|
| 159 |
+ |
|
| 160 |
+ .. sourcecode:: http |
|
| 161 |
+ |
|
| 162 |
+ GET /containers/4fa6e0f0c678/json HTTP/1.1 |
|
| 163 |
+ |
|
| 164 |
+ **Example response**: |
|
| 165 |
+ |
|
| 166 |
+ .. sourcecode:: http |
|
| 167 |
+ |
|
| 168 |
+ HTTP/1.1 200 OK |
|
| 169 |
+ Content-Type: application/json |
|
| 170 |
+ |
|
| 171 |
+ {
|
|
| 172 |
+ "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2", |
|
| 173 |
+ "Created": "2013-05-07T14:51:42.041847+02:00", |
|
| 174 |
+ "Path": "date", |
|
| 175 |
+ "Args": [], |
|
| 176 |
+ "Config": {
|
|
| 177 |
+ "Hostname": "4fa6e0f0c678", |
|
| 178 |
+ "User": "", |
|
| 179 |
+ "Memory": 0, |
|
| 180 |
+ "MemorySwap": 0, |
|
| 181 |
+ "AttachStdin": false, |
|
| 182 |
+ "AttachStdout": true, |
|
| 183 |
+ "AttachStderr": true, |
|
| 184 |
+ "PortSpecs": null, |
|
| 185 |
+ "Tty": false, |
|
| 186 |
+ "OpenStdin": false, |
|
| 187 |
+ "StdinOnce": false, |
|
| 188 |
+ "Env": null, |
|
| 189 |
+ "Cmd": [ |
|
| 190 |
+ "date" |
|
| 191 |
+ ], |
|
| 192 |
+ "Dns": null, |
|
| 193 |
+ "Image": "base", |
|
| 194 |
+ "Volumes": {},
|
|
| 195 |
+ "VolumesFrom": "" |
|
| 196 |
+ }, |
|
| 197 |
+ "State": {
|
|
| 198 |
+ "Running": false, |
|
| 199 |
+ "Pid": 0, |
|
| 200 |
+ "ExitCode": 0, |
|
| 201 |
+ "StartedAt": "2013-05-07T14:51:42.087658+02:01360", |
|
| 202 |
+ "Ghost": false |
|
| 203 |
+ }, |
|
| 204 |
+ "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", |
|
| 205 |
+ "NetworkSettings": {
|
|
| 206 |
+ "IpAddress": "", |
|
| 207 |
+ "IpPrefixLen": 0, |
|
| 208 |
+ "Gateway": "", |
|
| 209 |
+ "Bridge": "", |
|
| 210 |
+ "PortMapping": null |
|
| 211 |
+ }, |
|
| 212 |
+ "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker", |
|
| 213 |
+ "ResolvConfPath": "/etc/resolv.conf", |
|
| 214 |
+ "Volumes": {}
|
|
| 215 |
+ } |
|
| 216 |
+ |
|
| 217 |
+ :statuscode 200: no error |
|
| 218 |
+ :statuscode 404: no such container |
|
| 219 |
+ :statuscode 500: server error |
|
| 220 |
+ |
|
| 221 |
+ |
|
| 222 |
+List processes running inside a container |
|
| 223 |
+***************************************** |
|
| 224 |
+ |
|
| 225 |
+.. http:get:: /containers/(id)/top |
|
| 226 |
+ |
|
| 227 |
+ List processes running inside the container ``id`` |
|
| 228 |
+ |
|
| 229 |
+ **Example request**: |
|
| 230 |
+ |
|
| 231 |
+ .. sourcecode:: http |
|
| 232 |
+ |
|
| 233 |
+ GET /containers/4fa6e0f0c678/top HTTP/1.1 |
|
| 234 |
+ |
|
| 235 |
+ **Example response**: |
|
| 236 |
+ |
|
| 237 |
+ .. sourcecode:: http |
|
| 238 |
+ |
|
| 239 |
+ HTTP/1.1 200 OK |
|
| 240 |
+ Content-Type: application/json |
|
| 241 |
+ |
|
| 242 |
+ {
|
|
| 243 |
+ "Titles":[ |
|
| 244 |
+ "USER", |
|
| 245 |
+ "PID", |
|
| 246 |
+ "%CPU", |
|
| 247 |
+ "%MEM", |
|
| 248 |
+ "VSZ", |
|
| 249 |
+ "RSS", |
|
| 250 |
+ "TTY", |
|
| 251 |
+ "STAT", |
|
| 252 |
+ "START", |
|
| 253 |
+ "TIME", |
|
| 254 |
+ "COMMAND" |
|
| 255 |
+ ], |
|
| 256 |
+ "Processes":[ |
|
| 257 |
+ ["root","20147","0.0","0.1","18060","1864","pts/4","S","10:06","0:00","bash"], |
|
| 258 |
+ ["root","20271","0.0","0.0","4312","352","pts/4","S+","10:07","0:00","sleep","10"] |
|
| 259 |
+ ] |
|
| 260 |
+ } |
|
| 261 |
+ |
|
| 262 |
+ :query ps_args: ps arguments to use (eg. aux) |
|
| 263 |
+ :statuscode 200: no error |
|
| 264 |
+ :statuscode 404: no such container |
|
| 265 |
+ :statuscode 500: server error |
|
| 266 |
+ |
|
| 267 |
+ |
|
| 268 |
+Inspect changes on a container's filesystem |
|
| 269 |
+******************************************* |
|
| 270 |
+ |
|
| 271 |
+.. http:get:: /containers/(id)/changes |
|
| 272 |
+ |
|
| 273 |
+ Inspect changes on container ``id`` 's filesystem |
|
| 274 |
+ |
|
| 275 |
+ **Example request**: |
|
| 276 |
+ |
|
| 277 |
+ .. sourcecode:: http |
|
| 278 |
+ |
|
| 279 |
+ GET /containers/4fa6e0f0c678/changes HTTP/1.1 |
|
| 280 |
+ |
|
| 281 |
+ |
|
| 282 |
+ **Example response**: |
|
| 283 |
+ |
|
| 284 |
+ .. sourcecode:: http |
|
| 285 |
+ |
|
| 286 |
+ HTTP/1.1 200 OK |
|
| 287 |
+ Content-Type: application/json |
|
| 288 |
+ |
|
| 289 |
+ [ |
|
| 290 |
+ {
|
|
| 291 |
+ "Path":"/dev", |
|
| 292 |
+ "Kind":0 |
|
| 293 |
+ }, |
|
| 294 |
+ {
|
|
| 295 |
+ "Path":"/dev/kmsg", |
|
| 296 |
+ "Kind":1 |
|
| 297 |
+ }, |
|
| 298 |
+ {
|
|
| 299 |
+ "Path":"/test", |
|
| 300 |
+ "Kind":1 |
|
| 301 |
+ } |
|
| 302 |
+ ] |
|
| 303 |
+ |
|
| 304 |
+ :statuscode 200: no error |
|
| 305 |
+ :statuscode 404: no such container |
|
| 306 |
+ :statuscode 500: server error |
|
| 307 |
+ |
|
| 308 |
+ |
|
| 309 |
+Export a container |
|
| 310 |
+****************** |
|
| 311 |
+ |
|
| 312 |
+.. http:get:: /containers/(id)/export |
|
| 313 |
+ |
|
| 314 |
+ Export the contents of container ``id`` |
|
| 315 |
+ |
|
| 316 |
+ **Example request**: |
|
| 317 |
+ |
|
| 318 |
+ .. sourcecode:: http |
|
| 319 |
+ |
|
| 320 |
+ GET /containers/4fa6e0f0c678/export HTTP/1.1 |
|
| 321 |
+ |
|
| 322 |
+ |
|
| 323 |
+ **Example response**: |
|
| 324 |
+ |
|
| 325 |
+ .. sourcecode:: http |
|
| 326 |
+ |
|
| 327 |
+ HTTP/1.1 200 OK |
|
| 328 |
+ Content-Type: application/octet-stream |
|
| 329 |
+ |
|
| 330 |
+ {{ STREAM }}
|
|
| 331 |
+ |
|
| 332 |
+ :statuscode 200: no error |
|
| 333 |
+ :statuscode 404: no such container |
|
| 334 |
+ :statuscode 500: server error |
|
| 335 |
+ |
|
| 336 |
+ |
|
| 337 |
+Start a container |
|
| 338 |
+***************** |
|
| 339 |
+ |
|
| 340 |
+.. http:post:: /containers/(id)/start |
|
| 341 |
+ |
|
| 342 |
+ Start the container ``id`` |
|
| 343 |
+ |
|
| 344 |
+ **Example request**: |
|
| 345 |
+ |
|
| 346 |
+ .. sourcecode:: http |
|
| 347 |
+ |
|
| 348 |
+ POST /containers/(id)/start HTTP/1.1 |
|
| 349 |
+ Content-Type: application/json |
|
| 350 |
+ |
|
| 351 |
+ {
|
|
| 352 |
+ "Binds":["/tmp:/tmp"] |
|
| 353 |
+ } |
|
| 354 |
+ |
|
| 355 |
+ **Example response**: |
|
| 356 |
+ |
|
| 357 |
+ .. sourcecode:: http |
|
| 358 |
+ |
|
| 359 |
+ HTTP/1.1 204 No Content |
|
| 360 |
+ Content-Type: text/plain |
|
| 361 |
+ |
|
| 362 |
+ :jsonparam hostConfig: the container's host configuration (optional) |
|
| 363 |
+ :statuscode 200: no error |
|
| 364 |
+ :statuscode 404: no such container |
|
| 365 |
+ :statuscode 500: server error |
|
| 366 |
+ |
|
| 367 |
+ |
|
| 368 |
+Stop a contaier |
|
| 369 |
+*************** |
|
| 370 |
+ |
|
| 371 |
+.. http:post:: /containers/(id)/stop |
|
| 372 |
+ |
|
| 373 |
+ Stop the container ``id`` |
|
| 374 |
+ |
|
| 375 |
+ **Example request**: |
|
| 376 |
+ |
|
| 377 |
+ .. sourcecode:: http |
|
| 378 |
+ |
|
| 379 |
+ POST /containers/e90e34656806/stop?t=5 HTTP/1.1 |
|
| 380 |
+ |
|
| 381 |
+ **Example response**: |
|
| 382 |
+ |
|
| 383 |
+ .. sourcecode:: http |
|
| 384 |
+ |
|
| 385 |
+ HTTP/1.1 204 OK |
|
| 386 |
+ |
|
| 387 |
+ :query t: number of seconds to wait before killing the container |
|
| 388 |
+ :statuscode 204: no error |
|
| 389 |
+ :statuscode 404: no such container |
|
| 390 |
+ :statuscode 500: server error |
|
| 391 |
+ |
|
| 392 |
+ |
|
| 393 |
+Restart a container |
|
| 394 |
+******************* |
|
| 395 |
+ |
|
| 396 |
+.. http:post:: /containers/(id)/restart |
|
| 397 |
+ |
|
| 398 |
+ Restart the container ``id`` |
|
| 399 |
+ |
|
| 400 |
+ **Example request**: |
|
| 401 |
+ |
|
| 402 |
+ .. sourcecode:: http |
|
| 403 |
+ |
|
| 404 |
+ POST /containers/e90e34656806/restart?t=5 HTTP/1.1 |
|
| 405 |
+ |
|
| 406 |
+ **Example response**: |
|
| 407 |
+ |
|
| 408 |
+ .. sourcecode:: http |
|
| 409 |
+ |
|
| 410 |
+ HTTP/1.1 204 OK |
|
| 411 |
+ |
|
| 412 |
+ :query t: number of seconds to wait before killing the container |
|
| 413 |
+ :statuscode 204: no error |
|
| 414 |
+ :statuscode 404: no such container |
|
| 415 |
+ :statuscode 500: server error |
|
| 416 |
+ |
|
| 417 |
+ |
|
| 418 |
+Kill a container |
|
| 419 |
+**************** |
|
| 420 |
+ |
|
| 421 |
+.. http:post:: /containers/(id)/kill |
|
| 422 |
+ |
|
| 423 |
+ Kill the container ``id`` |
|
| 424 |
+ |
|
| 425 |
+ **Example request**: |
|
| 426 |
+ |
|
| 427 |
+ .. sourcecode:: http |
|
| 428 |
+ |
|
| 429 |
+ POST /containers/e90e34656806/kill HTTP/1.1 |
|
| 430 |
+ |
|
| 431 |
+ **Example response**: |
|
| 432 |
+ |
|
| 433 |
+ .. sourcecode:: http |
|
| 434 |
+ |
|
| 435 |
+ HTTP/1.1 204 OK |
|
| 436 |
+ |
|
| 437 |
+ :statuscode 204: no error |
|
| 438 |
+ :statuscode 404: no such container |
|
| 439 |
+ :statuscode 500: server error |
|
| 440 |
+ |
|
| 441 |
+ |
|
| 442 |
+Attach to a container |
|
| 443 |
+********************* |
|
| 444 |
+ |
|
| 445 |
+.. http:post:: /containers/(id)/attach |
|
| 446 |
+ |
|
| 447 |
+ Attach to the container ``id`` |
|
| 448 |
+ |
|
| 449 |
+ **Example request**: |
|
| 450 |
+ |
|
| 451 |
+ .. sourcecode:: http |
|
| 452 |
+ |
|
| 453 |
+ POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1 |
|
| 454 |
+ |
|
| 455 |
+ **Example response**: |
|
| 456 |
+ |
|
| 457 |
+ .. sourcecode:: http |
|
| 458 |
+ |
|
| 459 |
+ HTTP/1.1 200 OK |
|
| 460 |
+ Content-Type: application/vnd.docker.raw-stream |
|
| 461 |
+ |
|
| 462 |
+ {{ STREAM }}
|
|
| 463 |
+ |
|
| 464 |
+ :query logs: 1/True/true or 0/False/false, return logs. Default false |
|
| 465 |
+ :query stream: 1/True/true or 0/False/false, return stream. Default false |
|
| 466 |
+ :query stdin: 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false |
|
| 467 |
+ :query stdout: 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false |
|
| 468 |
+ :query stderr: 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false |
|
| 469 |
+ :statuscode 200: no error |
|
| 470 |
+ :statuscode 400: bad parameter |
|
| 471 |
+ :statuscode 404: no such container |
|
| 472 |
+ :statuscode 500: server error |
|
| 473 |
+ |
|
| 474 |
+ |
|
| 475 |
+Wait a container |
|
| 476 |
+**************** |
|
| 477 |
+ |
|
| 478 |
+.. http:post:: /containers/(id)/wait |
|
| 479 |
+ |
|
| 480 |
+ Block until container ``id`` stops, then returns the exit code |
|
| 481 |
+ |
|
| 482 |
+ **Example request**: |
|
| 483 |
+ |
|
| 484 |
+ .. sourcecode:: http |
|
| 485 |
+ |
|
| 486 |
+ POST /containers/16253994b7c4/wait HTTP/1.1 |
|
| 487 |
+ |
|
| 488 |
+ **Example response**: |
|
| 489 |
+ |
|
| 490 |
+ .. sourcecode:: http |
|
| 491 |
+ |
|
| 492 |
+ HTTP/1.1 200 OK |
|
| 493 |
+ Content-Type: application/json |
|
| 494 |
+ |
|
| 495 |
+ {"StatusCode":0}
|
|
| 496 |
+ |
|
| 497 |
+ :statuscode 200: no error |
|
| 498 |
+ :statuscode 404: no such container |
|
| 499 |
+ :statuscode 500: server error |
|
| 500 |
+ |
|
| 501 |
+ |
|
| 502 |
+Remove a container |
|
| 503 |
+******************* |
|
| 504 |
+ |
|
| 505 |
+.. http:delete:: /containers/(id) |
|
| 506 |
+ |
|
| 507 |
+ Remove the container ``id`` from the filesystem |
|
| 508 |
+ |
|
| 509 |
+ **Example request**: |
|
| 510 |
+ |
|
| 511 |
+ .. sourcecode:: http |
|
| 512 |
+ |
|
| 513 |
+ DELETE /containers/16253994b7c4?v=1 HTTP/1.1 |
|
| 514 |
+ |
|
| 515 |
+ **Example response**: |
|
| 516 |
+ |
|
| 517 |
+ .. sourcecode:: http |
|
| 518 |
+ |
|
| 519 |
+ HTTP/1.1 204 OK |
|
| 520 |
+ |
|
| 521 |
+ :query v: 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false |
|
| 522 |
+ :statuscode 204: no error |
|
| 523 |
+ :statuscode 400: bad parameter |
|
| 524 |
+ :statuscode 404: no such container |
|
| 525 |
+ :statuscode 500: server error |
|
| 526 |
+ |
|
| 527 |
+ |
|
| 528 |
+2.2 Images |
|
| 529 |
+---------- |
|
| 530 |
+ |
|
| 531 |
+List Images |
|
| 532 |
+*********** |
|
| 533 |
+ |
|
| 534 |
+.. http:get:: /images/(format) |
|
| 535 |
+ |
|
| 536 |
+ List images ``format`` could be json or viz (json default) |
|
| 537 |
+ |
|
| 538 |
+ **Example request**: |
|
| 539 |
+ |
|
| 540 |
+ .. sourcecode:: http |
|
| 541 |
+ |
|
| 542 |
+ GET /images/json?all=0 HTTP/1.1 |
|
| 543 |
+ |
|
| 544 |
+ **Example response**: |
|
| 545 |
+ |
|
| 546 |
+ .. sourcecode:: http |
|
| 547 |
+ |
|
| 548 |
+ HTTP/1.1 200 OK |
|
| 549 |
+ Content-Type: application/json |
|
| 550 |
+ |
|
| 551 |
+ [ |
|
| 552 |
+ {
|
|
| 553 |
+ "Repository":"base", |
|
| 554 |
+ "Tag":"ubuntu-12.10", |
|
| 555 |
+ "Id":"b750fe79269d", |
|
| 556 |
+ "Created":1364102658, |
|
| 557 |
+ "Size":24653, |
|
| 558 |
+ "VirtualSize":180116135 |
|
| 559 |
+ }, |
|
| 560 |
+ {
|
|
| 561 |
+ "Repository":"base", |
|
| 562 |
+ "Tag":"ubuntu-quantal", |
|
| 563 |
+ "Id":"b750fe79269d", |
|
| 564 |
+ "Created":1364102658, |
|
| 565 |
+ "Size":24653, |
|
| 566 |
+ "VirtualSize":180116135 |
|
| 567 |
+ } |
|
| 568 |
+ ] |
|
| 569 |
+ |
|
| 570 |
+ |
|
| 571 |
+ **Example request**: |
|
| 572 |
+ |
|
| 573 |
+ .. sourcecode:: http |
|
| 574 |
+ |
|
| 575 |
+ GET /images/viz HTTP/1.1 |
|
| 576 |
+ |
|
| 577 |
+ **Example response**: |
|
| 578 |
+ |
|
| 579 |
+ .. sourcecode:: http |
|
| 580 |
+ |
|
| 581 |
+ HTTP/1.1 200 OK |
|
| 582 |
+ Content-Type: text/plain |
|
| 583 |
+ |
|
| 584 |
+ digraph docker {
|
|
| 585 |
+ "d82cbacda43a" -> "074be284591f" |
|
| 586 |
+ "1496068ca813" -> "08306dc45919" |
|
| 587 |
+ "08306dc45919" -> "0e7893146ac2" |
|
| 588 |
+ "b750fe79269d" -> "1496068ca813" |
|
| 589 |
+ base -> "27cf78414709" [style=invis] |
|
| 590 |
+ "f71189fff3de" -> "9a33b36209ed" |
|
| 591 |
+ "27cf78414709" -> "b750fe79269d" |
|
| 592 |
+ "0e7893146ac2" -> "d6434d954665" |
|
| 593 |
+ "d6434d954665" -> "d82cbacda43a" |
|
| 594 |
+ base -> "e9aa60c60128" [style=invis] |
|
| 595 |
+ "074be284591f" -> "f71189fff3de" |
|
| 596 |
+ "b750fe79269d" [label="b750fe79269d\nbase",shape=box,fillcolor="paleturquoise",style="filled,rounded"]; |
|
| 597 |
+ "e9aa60c60128" [label="e9aa60c60128\nbase2",shape=box,fillcolor="paleturquoise",style="filled,rounded"]; |
|
| 598 |
+ "9a33b36209ed" [label="9a33b36209ed\ntest",shape=box,fillcolor="paleturquoise",style="filled,rounded"]; |
|
| 599 |
+ base [style=invisible] |
|
| 600 |
+ } |
|
| 601 |
+ |
|
| 602 |
+ :query all: 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default |
|
| 603 |
+ :statuscode 200: no error |
|
| 604 |
+ :statuscode 400: bad parameter |
|
| 605 |
+ :statuscode 500: server error |
|
| 606 |
+ |
|
| 607 |
+ |
|
| 608 |
+Create an image |
|
| 609 |
+*************** |
|
| 610 |
+ |
|
| 611 |
+.. http:post:: /images/create |
|
| 612 |
+ |
|
| 613 |
+ Create an image, either by pull it from the registry or by importing it |
|
| 614 |
+ |
|
| 615 |
+ **Example request**: |
|
| 616 |
+ |
|
| 617 |
+ .. sourcecode:: http |
|
| 618 |
+ |
|
| 619 |
+ POST /images/create?fromImage=base HTTP/1.1 |
|
| 620 |
+ |
|
| 621 |
+ **Example response**: |
|
| 622 |
+ |
|
| 623 |
+ .. sourcecode:: http |
|
| 624 |
+ |
|
| 625 |
+ HTTP/1.1 200 OK |
|
| 626 |
+ Content-Type: application/json |
|
| 627 |
+ |
|
| 628 |
+ {"status":"Pulling..."}
|
|
| 629 |
+ {"status":"Pulling", "progress":"1/? (n/a)"}
|
|
| 630 |
+ {"error":"Invalid..."}
|
|
| 631 |
+ ... |
|
| 632 |
+ |
|
| 633 |
+ :query fromImage: name of the image to pull |
|
| 634 |
+ :query fromSrc: source to import, - means stdin |
|
| 635 |
+ :query repo: repository |
|
| 636 |
+ :query tag: tag |
|
| 637 |
+ :query registry: the registry to pull from |
|
| 638 |
+ :statuscode 200: no error |
|
| 639 |
+ :statuscode 500: server error |
|
| 640 |
+ |
|
| 641 |
+ |
|
| 642 |
+Insert a file in a image |
|
| 643 |
+************************ |
|
| 644 |
+ |
|
| 645 |
+.. http:post:: /images/(name)/insert |
|
| 646 |
+ |
|
| 647 |
+ Insert a file from ``url`` in the image ``name`` at ``path`` |
|
| 648 |
+ |
|
| 649 |
+ **Example request**: |
|
| 650 |
+ |
|
| 651 |
+ .. sourcecode:: http |
|
| 652 |
+ |
|
| 653 |
+ POST /images/test/insert?path=/usr&url=myurl HTTP/1.1 |
|
| 654 |
+ |
|
| 655 |
+ **Example response**: |
|
| 656 |
+ |
|
| 657 |
+ .. sourcecode:: http |
|
| 658 |
+ |
|
| 659 |
+ HTTP/1.1 200 OK |
|
| 660 |
+ Content-Type: application/json |
|
| 661 |
+ |
|
| 662 |
+ {"status":"Inserting..."}
|
|
| 663 |
+ {"status":"Inserting", "progress":"1/? (n/a)"}
|
|
| 664 |
+ {"error":"Invalid..."}
|
|
| 665 |
+ ... |
|
| 666 |
+ |
|
| 667 |
+ :statuscode 200: no error |
|
| 668 |
+ :statuscode 500: server error |
|
| 669 |
+ |
|
| 670 |
+ |
|
| 671 |
+Inspect an image |
|
| 672 |
+**************** |
|
| 673 |
+ |
|
| 674 |
+.. http:get:: /images/(name)/json |
|
| 675 |
+ |
|
| 676 |
+ Return low-level information on the image ``name`` |
|
| 677 |
+ |
|
| 678 |
+ **Example request**: |
|
| 679 |
+ |
|
| 680 |
+ .. sourcecode:: http |
|
| 681 |
+ |
|
| 682 |
+ GET /images/base/json HTTP/1.1 |
|
| 683 |
+ |
|
| 684 |
+ **Example response**: |
|
| 685 |
+ |
|
| 686 |
+ .. sourcecode:: http |
|
| 687 |
+ |
|
| 688 |
+ HTTP/1.1 200 OK |
|
| 689 |
+ Content-Type: application/json |
|
| 690 |
+ |
|
| 691 |
+ {
|
|
| 692 |
+ "id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc", |
|
| 693 |
+ "parent":"27cf784147099545", |
|
| 694 |
+ "created":"2013-03-23T22:24:18.818426-07:00", |
|
| 695 |
+ "container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0", |
|
| 696 |
+ "container_config": |
|
| 697 |
+ {
|
|
| 698 |
+ "Hostname":"", |
|
| 699 |
+ "User":"", |
|
| 700 |
+ "Memory":0, |
|
| 701 |
+ "MemorySwap":0, |
|
| 702 |
+ "AttachStdin":false, |
|
| 703 |
+ "AttachStdout":false, |
|
| 704 |
+ "AttachStderr":false, |
|
| 705 |
+ "PortSpecs":null, |
|
| 706 |
+ "Tty":true, |
|
| 707 |
+ "OpenStdin":true, |
|
| 708 |
+ "StdinOnce":false, |
|
| 709 |
+ "Env":null, |
|
| 710 |
+ "Cmd": ["/bin/bash"] |
|
| 711 |
+ ,"Dns":null, |
|
| 712 |
+ "Image":"base", |
|
| 713 |
+ "Volumes":null, |
|
| 714 |
+ "VolumesFrom":"" |
|
| 715 |
+ }, |
|
| 716 |
+ "Size": 6824592 |
|
| 717 |
+ } |
|
| 718 |
+ |
|
| 719 |
+ :statuscode 200: no error |
|
| 720 |
+ :statuscode 404: no such image |
|
| 721 |
+ :statuscode 500: server error |
|
| 722 |
+ |
|
| 723 |
+ |
|
| 724 |
+Get the history of an image |
|
| 725 |
+*************************** |
|
| 726 |
+ |
|
| 727 |
+.. http:get:: /images/(name)/history |
|
| 728 |
+ |
|
| 729 |
+ Return the history of the image ``name`` |
|
| 730 |
+ |
|
| 731 |
+ **Example request**: |
|
| 732 |
+ |
|
| 733 |
+ .. sourcecode:: http |
|
| 734 |
+ |
|
| 735 |
+ GET /images/base/history HTTP/1.1 |
|
| 736 |
+ |
|
| 737 |
+ **Example response**: |
|
| 738 |
+ |
|
| 739 |
+ .. sourcecode:: http |
|
| 740 |
+ |
|
| 741 |
+ HTTP/1.1 200 OK |
|
| 742 |
+ Content-Type: application/json |
|
| 743 |
+ |
|
| 744 |
+ [ |
|
| 745 |
+ {
|
|
| 746 |
+ "Id":"b750fe79269d", |
|
| 747 |
+ "Created":1364102658, |
|
| 748 |
+ "CreatedBy":"/bin/bash" |
|
| 749 |
+ }, |
|
| 750 |
+ {
|
|
| 751 |
+ "Id":"27cf78414709", |
|
| 752 |
+ "Created":1364068391, |
|
| 753 |
+ "CreatedBy":"" |
|
| 754 |
+ } |
|
| 755 |
+ ] |
|
| 756 |
+ |
|
| 757 |
+ :statuscode 200: no error |
|
| 758 |
+ :statuscode 404: no such image |
|
| 759 |
+ :statuscode 500: server error |
|
| 760 |
+ |
|
| 761 |
+ |
|
| 762 |
+Push an image on the registry |
|
| 763 |
+***************************** |
|
| 764 |
+ |
|
| 765 |
+.. http:post:: /images/(name)/push |
|
| 766 |
+ |
|
| 767 |
+ Push the image ``name`` on the registry |
|
| 768 |
+ |
|
| 769 |
+ **Example request**: |
|
| 770 |
+ |
|
| 771 |
+ .. sourcecode:: http |
|
| 772 |
+ |
|
| 773 |
+ POST /images/test/push HTTP/1.1 |
|
| 774 |
+ {{ authConfig }}
|
|
| 775 |
+ |
|
| 776 |
+ **Example response**: |
|
| 777 |
+ |
|
| 778 |
+ .. sourcecode:: http |
|
| 779 |
+ |
|
| 780 |
+ HTTP/1.1 200 OK |
|
| 781 |
+ Content-Type: application/json |
|
| 782 |
+ |
|
| 783 |
+ {"status":"Pushing..."}
|
|
| 784 |
+ {"status":"Pushing", "progress":"1/? (n/a)"}
|
|
| 785 |
+ {"error":"Invalid..."}
|
|
| 786 |
+ ... |
|
| 787 |
+ |
|
| 788 |
+ :query registry: the registry you wan to push, optional |
|
| 789 |
+ :statuscode 200: no error |
|
| 790 |
+ :statuscode 404: no such image |
|
| 791 |
+ :statuscode 500: server error |
|
| 792 |
+ |
|
| 793 |
+ |
|
| 794 |
+Tag an image into a repository |
|
| 795 |
+****************************** |
|
| 796 |
+ |
|
| 797 |
+.. http:post:: /images/(name)/tag |
|
| 798 |
+ |
|
| 799 |
+ Tag the image ``name`` into a repository |
|
| 800 |
+ |
|
| 801 |
+ **Example request**: |
|
| 802 |
+ |
|
| 803 |
+ .. sourcecode:: http |
|
| 804 |
+ |
|
| 805 |
+ POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1 |
|
| 806 |
+ |
|
| 807 |
+ **Example response**: |
|
| 808 |
+ |
|
| 809 |
+ .. sourcecode:: http |
|
| 810 |
+ |
|
| 811 |
+ HTTP/1.1 200 OK |
|
| 812 |
+ |
|
| 813 |
+ :query repo: The repository to tag in |
|
| 814 |
+ :query force: 1/True/true or 0/False/false, default false |
|
| 815 |
+ :statuscode 200: no error |
|
| 816 |
+ :statuscode 400: bad parameter |
|
| 817 |
+ :statuscode 404: no such image |
|
| 818 |
+ :statuscode 409: conflict |
|
| 819 |
+ :statuscode 500: server error |
|
| 820 |
+ |
|
| 821 |
+ |
|
| 822 |
+Remove an image |
|
| 823 |
+*************** |
|
| 824 |
+ |
|
| 825 |
+.. http:delete:: /images/(name) |
|
| 826 |
+ |
|
| 827 |
+ Remove the image ``name`` from the filesystem |
|
| 828 |
+ |
|
| 829 |
+ **Example request**: |
|
| 830 |
+ |
|
| 831 |
+ .. sourcecode:: http |
|
| 832 |
+ |
|
| 833 |
+ DELETE /images/test HTTP/1.1 |
|
| 834 |
+ |
|
| 835 |
+ **Example response**: |
|
| 836 |
+ |
|
| 837 |
+ .. sourcecode:: http |
|
| 838 |
+ |
|
| 839 |
+ HTTP/1.1 200 OK |
|
| 840 |
+ Content-type: application/json |
|
| 841 |
+ |
|
| 842 |
+ [ |
|
| 843 |
+ {"Untagged":"3e2f21a89f"},
|
|
| 844 |
+ {"Deleted":"3e2f21a89f"},
|
|
| 845 |
+ {"Deleted":"53b4f83ac9"}
|
|
| 846 |
+ ] |
|
| 847 |
+ |
|
| 848 |
+ :statuscode 200: no error |
|
| 849 |
+ :statuscode 404: no such image |
|
| 850 |
+ :statuscode 409: conflict |
|
| 851 |
+ :statuscode 500: server error |
|
| 852 |
+ |
|
| 853 |
+ |
|
| 854 |
+Search images |
|
| 855 |
+************* |
|
| 856 |
+ |
|
| 857 |
+.. http:get:: /images/search |
|
| 858 |
+ |
|
| 859 |
+ Search for an image in the docker index |
|
| 860 |
+ |
|
| 861 |
+ **Example request**: |
|
| 862 |
+ |
|
| 863 |
+ .. sourcecode:: http |
|
| 864 |
+ |
|
| 865 |
+ GET /images/search?term=sshd HTTP/1.1 |
|
| 866 |
+ |
|
| 867 |
+ **Example response**: |
|
| 868 |
+ |
|
| 869 |
+ .. sourcecode:: http |
|
| 870 |
+ |
|
| 871 |
+ HTTP/1.1 200 OK |
|
| 872 |
+ Content-Type: application/json |
|
| 873 |
+ |
|
| 874 |
+ [ |
|
| 875 |
+ {
|
|
| 876 |
+ "Name":"cespare/sshd", |
|
| 877 |
+ "Description":"" |
|
| 878 |
+ }, |
|
| 879 |
+ {
|
|
| 880 |
+ "Name":"johnfuller/sshd", |
|
| 881 |
+ "Description":"" |
|
| 882 |
+ }, |
|
| 883 |
+ {
|
|
| 884 |
+ "Name":"dhrp/mongodb-sshd", |
|
| 885 |
+ "Description":"" |
|
| 886 |
+ } |
|
| 887 |
+ ] |
|
| 888 |
+ |
|
| 889 |
+ :query term: term to search |
|
| 890 |
+ :statuscode 200: no error |
|
| 891 |
+ :statuscode 500: server error |
|
| 892 |
+ |
|
| 893 |
+ |
|
| 894 |
+2.3 Misc |
|
| 895 |
+-------- |
|
| 896 |
+ |
|
| 897 |
+Build an image from Dockerfile via stdin |
|
| 898 |
+**************************************** |
|
| 899 |
+ |
|
| 900 |
+.. http:post:: /build |
|
| 901 |
+ |
|
| 902 |
+ Build an image from Dockerfile via stdin |
|
| 903 |
+ |
|
| 904 |
+ **Example request**: |
|
| 905 |
+ |
|
| 906 |
+ .. sourcecode:: http |
|
| 907 |
+ |
|
| 908 |
+ POST /build HTTP/1.1 |
|
| 909 |
+ |
|
| 910 |
+ {{ STREAM }}
|
|
| 911 |
+ |
|
| 912 |
+ **Example response**: |
|
| 913 |
+ |
|
| 914 |
+ .. sourcecode:: http |
|
| 915 |
+ |
|
| 916 |
+ HTTP/1.1 200 OK |
|
| 917 |
+ |
|
| 918 |
+ {{ STREAM }}
|
|
| 919 |
+ |
|
| 920 |
+ |
|
| 921 |
+ The stream must be a tar archive compressed with one of the following algorithms: |
|
| 922 |
+ identity (no compression), gzip, bzip2, xz. The archive must include a file called |
|
| 923 |
+ `Dockerfile` at its root. It may include any number of other files, which will be |
|
| 924 |
+ accessible in the build context (See the ADD build command). |
|
| 925 |
+ |
|
| 926 |
+ The Content-type header should be set to "application/tar". |
|
| 927 |
+ |
|
| 928 |
+ :query t: tag to be applied to the resulting image in case of success |
|
| 929 |
+ :query q: suppress verbose build output |
|
| 930 |
+ :statuscode 200: no error |
|
| 931 |
+ :statuscode 500: server error |
|
| 932 |
+ |
|
| 933 |
+ |
|
| 934 |
+Check auth configuration |
|
| 935 |
+************************ |
|
| 936 |
+ |
|
| 937 |
+.. http:post:: /auth |
|
| 938 |
+ |
|
| 939 |
+ Get the default username and email |
|
| 940 |
+ |
|
| 941 |
+ **Example request**: |
|
| 942 |
+ |
|
| 943 |
+ .. sourcecode:: http |
|
| 944 |
+ |
|
| 945 |
+ POST /auth HTTP/1.1 |
|
| 946 |
+ Content-Type: application/json |
|
| 947 |
+ |
|
| 948 |
+ {
|
|
| 949 |
+ "username":"hannibal", |
|
| 950 |
+ "password:"xxxx", |
|
| 951 |
+ "email":"hannibal@a-team.com" |
|
| 952 |
+ } |
|
| 953 |
+ |
|
| 954 |
+ **Example response**: |
|
| 955 |
+ |
|
| 956 |
+ .. sourcecode:: http |
|
| 957 |
+ |
|
| 958 |
+ HTTP/1.1 200 OK |
|
| 959 |
+ |
|
| 960 |
+ :statuscode 200: no error |
|
| 961 |
+ :statuscode 204: no error |
|
| 962 |
+ :statuscode 500: server error |
|
| 963 |
+ |
|
| 964 |
+ |
|
| 965 |
+Display system-wide information |
|
| 966 |
+******************************* |
|
| 967 |
+ |
|
| 968 |
+.. http:get:: /info |
|
| 969 |
+ |
|
| 970 |
+ Display system-wide information |
|
| 971 |
+ |
|
| 972 |
+ **Example request**: |
|
| 973 |
+ |
|
| 974 |
+ .. sourcecode:: http |
|
| 975 |
+ |
|
| 976 |
+ GET /info HTTP/1.1 |
|
| 977 |
+ |
|
| 978 |
+ **Example response**: |
|
| 979 |
+ |
|
| 980 |
+ .. sourcecode:: http |
|
| 981 |
+ |
|
| 982 |
+ HTTP/1.1 200 OK |
|
| 983 |
+ Content-Type: application/json |
|
| 984 |
+ |
|
| 985 |
+ {
|
|
| 986 |
+ "Containers":11, |
|
| 987 |
+ "Images":16, |
|
| 988 |
+ "Debug":false, |
|
| 989 |
+ "NFd": 11, |
|
| 990 |
+ "NGoroutines":21, |
|
| 991 |
+ "MemoryLimit":true, |
|
| 992 |
+ "SwapLimit":false |
|
| 993 |
+ } |
|
| 994 |
+ |
|
| 995 |
+ :statuscode 200: no error |
|
| 996 |
+ :statuscode 500: server error |
|
| 997 |
+ |
|
| 998 |
+ |
|
| 999 |
+Show the docker version information |
|
| 1000 |
+*********************************** |
|
| 1001 |
+ |
|
| 1002 |
+.. http:get:: /version |
|
| 1003 |
+ |
|
| 1004 |
+ Show the docker version information |
|
| 1005 |
+ |
|
| 1006 |
+ **Example request**: |
|
| 1007 |
+ |
|
| 1008 |
+ .. sourcecode:: http |
|
| 1009 |
+ |
|
| 1010 |
+ GET /version HTTP/1.1 |
|
| 1011 |
+ |
|
| 1012 |
+ **Example response**: |
|
| 1013 |
+ |
|
| 1014 |
+ .. sourcecode:: http |
|
| 1015 |
+ |
|
| 1016 |
+ HTTP/1.1 200 OK |
|
| 1017 |
+ Content-Type: application/json |
|
| 1018 |
+ |
|
| 1019 |
+ {
|
|
| 1020 |
+ "Version":"0.2.2", |
|
| 1021 |
+ "GitCommit":"5a2a5cc+CHANGES", |
|
| 1022 |
+ "GoVersion":"go1.0.3" |
|
| 1023 |
+ } |
|
| 1024 |
+ |
|
| 1025 |
+ :statuscode 200: no error |
|
| 1026 |
+ :statuscode 500: server error |
|
| 1027 |
+ |
|
| 1028 |
+ |
|
| 1029 |
+Create a new image from a container's changes |
|
| 1030 |
+********************************************* |
|
| 1031 |
+ |
|
| 1032 |
+.. http:post:: /commit |
|
| 1033 |
+ |
|
| 1034 |
+ Create a new image from a container's changes |
|
| 1035 |
+ |
|
| 1036 |
+ **Example request**: |
|
| 1037 |
+ |
|
| 1038 |
+ .. sourcecode:: http |
|
| 1039 |
+ |
|
| 1040 |
+ POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1 |
|
| 1041 |
+ |
|
| 1042 |
+ **Example response**: |
|
| 1043 |
+ |
|
| 1044 |
+ .. sourcecode:: http |
|
| 1045 |
+ |
|
| 1046 |
+ HTTP/1.1 201 OK |
|
| 1047 |
+ Content-Type: application/vnd.docker.raw-stream |
|
| 1048 |
+ |
|
| 1049 |
+ {"Id":"596069db4bf5"}
|
|
| 1050 |
+ |
|
| 1051 |
+ :query container: source container |
|
| 1052 |
+ :query repo: repository |
|
| 1053 |
+ :query tag: tag |
|
| 1054 |
+ :query m: commit message |
|
| 1055 |
+ :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>") |
|
| 1056 |
+ :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
|
|
| 1057 |
+ :statuscode 201: no error |
|
| 1058 |
+ :statuscode 404: no such container |
|
| 1059 |
+ :statuscode 500: server error |
|
| 1060 |
+ |
|
| 1061 |
+ |
|
| 1062 |
+3. Going further |
|
| 1063 |
+================ |
|
| 1064 |
+ |
|
| 1065 |
+3.1 Inside 'docker run' |
|
| 1066 |
+----------------------- |
|
| 1067 |
+ |
|
| 1068 |
+Here are the steps of 'docker run' : |
|
| 1069 |
+ |
|
| 1070 |
+* Create the container |
|
| 1071 |
+* If the status code is 404, it means the image doesn't exists: |
|
| 1072 |
+ * Try to pull it |
|
| 1073 |
+ * Then retry to create the container |
|
| 1074 |
+* Start the container |
|
| 1075 |
+* If you are not in detached mode: |
|
| 1076 |
+ * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1 |
|
| 1077 |
+* If in detached mode or only stdin is attached: |
|
| 1078 |
+ * Display the container's id |
|
| 1079 |
+ |
|
| 1080 |
+ |
|
| 1081 |
+3.2 Hijacking |
|
| 1082 |
+------------- |
|
| 1083 |
+ |
|
| 1084 |
+In this version of the API, /attach, uses hijacking to transport stdin, stdout and stderr on the same socket. This might change in the future. |
|
| 1085 |
+ |
|
| 1086 |
+3.3 CORS Requests |
|
| 1087 |
+----------------- |
|
| 1088 |
+ |
|
| 1089 |
+To enable cross origin requests to the remote api add the flag "-api-enable-cors" when running docker in daemon mode. |
|
| 1090 |
+ |
|
| 1091 |
+ docker -d -H="192.168.1.9:4243" -api-enable-cors |
|
| 1092 |
+ |