docker_remote_api.rst 21 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. :title: Remote API
  2. :description: API Documentation for Docker
  3. :keywords: API, Docker, rcli, REST, documentation
  4. =================
  5. Docker Remote API
  6. =================
  7. .. contents:: Table of Contents
  8. 1. Brief introduction
  9. =====================
  10. - The Remote API is replacing rcli
  11. - Default port in the docker deamon is 4243
  12. - 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
  13. - Since API version 1.2, the auth configuration is now handled client side, so the client has to send the authConfig as POST in /images/create and /images/<name>/pull
  14. 2. Version
  15. ==========
  16. The current verson of the API is 1.2
  17. Calling /images/<name>/insert is the same as calling /v1.2/images/<name>/insert
  18. You can still call an old version of the api using /v1.0/images/<name>/insert
  19. 3. Endpoints
  20. ============
  21. 3.1 Containers
  22. --------------
  23. List containers
  24. ***************
  25. .. http:get:: /containers/json
  26. List containers
  27. **Example request**:
  28. .. sourcecode:: http
  29. GET /containers/json?all=1&before=8dfafdbc3a40 HTTP/1.1
  30. **Example response**:
  31. .. sourcecode:: http
  32. HTTP/1.1 200 OK
  33. Content-Type: application/json
  34. [
  35. {
  36. "Id": "8dfafdbc3a40",
  37. "Image": "base:latest",
  38. "Command": "echo 1",
  39. "Created": 1367854155,
  40. "Status": "Exit 0"
  41. },
  42. {
  43. "Id": "9cd87474be90",
  44. "Image": "base:latest",
  45. "Command": "echo 222222",
  46. "Created": 1367854155,
  47. "Status": "Exit 0"
  48. },
  49. {
  50. "Id": "3176a2479c92",
  51. "Image": "base:latest",
  52. "Command": "echo 3333333333333333",
  53. "Created": 1367854154,
  54. "Status": "Exit 0"
  55. },
  56. {
  57. "Id": "4cb07b47f9fb",
  58. "Image": "base:latest",
  59. "Command": "echo 444444444444444444444444444444444",
  60. "Created": 1367854152,
  61. "Status": "Exit 0"
  62. }
  63. ]
  64. :query all: 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default
  65. :query limit: Show ``limit`` last created containers, include non-running ones.
  66. :query since: Show only containers created since Id, include non-running ones.
  67. :query before: Show only containers created before Id, include non-running ones.
  68. :statuscode 200: no error
  69. :statuscode 400: bad parameter
  70. :statuscode 500: server error
  71. Create a container
  72. ******************
  73. .. http:post:: /containers/create
  74. Create a container
  75. **Example request**:
  76. .. sourcecode:: http
  77. POST /containers/create HTTP/1.1
  78. Content-Type: application/json
  79. {
  80. "Hostname":"",
  81. "User":"",
  82. "Memory":0,
  83. "MemorySwap":0,
  84. "AttachStdin":false,
  85. "AttachStdout":true,
  86. "AttachStderr":true,
  87. "PortSpecs":null,
  88. "Tty":false,
  89. "OpenStdin":false,
  90. "StdinOnce":false,
  91. "Env":null,
  92. "Cmd":[
  93. "date"
  94. ],
  95. "Dns":null,
  96. "Image":"base",
  97. "Volumes":{},
  98. "VolumesFrom":""
  99. }
  100. **Example response**:
  101. .. sourcecode:: http
  102. HTTP/1.1 201 OK
  103. Content-Type: application/json
  104. {
  105. "Id":"e90e34656806"
  106. "Warnings":[]
  107. }
  108. :jsonparam config: the container's configuration
  109. :statuscode 201: no error
  110. :statuscode 404: no such container
  111. :statuscode 406: impossible to attach (container not running)
  112. :statuscode 500: server error
  113. Inspect a container
  114. *******************
  115. .. http:get:: /containers/(id)/json
  116. Return low-level information on the container ``id``
  117. **Example request**:
  118. .. sourcecode:: http
  119. GET /containers/4fa6e0f0c678/json HTTP/1.1
  120. **Example response**:
  121. .. sourcecode:: http
  122. HTTP/1.1 200 OK
  123. Content-Type: application/json
  124. {
  125. "Id": "4fa6e0f0c6786287e131c3852c58a2e01cc697a68231826813597e4994f1d6e2",
  126. "Created": "2013-05-07T14:51:42.041847+02:00",
  127. "Path": "date",
  128. "Args": [],
  129. "Config": {
  130. "Hostname": "4fa6e0f0c678",
  131. "User": "",
  132. "Memory": 0,
  133. "MemorySwap": 0,
  134. "AttachStdin": false,
  135. "AttachStdout": true,
  136. "AttachStderr": true,
  137. "PortSpecs": null,
  138. "Tty": false,
  139. "OpenStdin": false,
  140. "StdinOnce": false,
  141. "Env": null,
  142. "Cmd": [
  143. "date"
  144. ],
  145. "Dns": null,
  146. "Image": "base",
  147. "Volumes": {},
  148. "VolumesFrom": ""
  149. },
  150. "State": {
  151. "Running": false,
  152. "Pid": 0,
  153. "ExitCode": 0,
  154. "StartedAt": "2013-05-07T14:51:42.087658+02:01360",
  155. "Ghost": false
  156. },
  157. "Image": "b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  158. "NetworkSettings": {
  159. "IpAddress": "",
  160. "IpPrefixLen": 0,
  161. "Gateway": "",
  162. "Bridge": "",
  163. "PortMapping": null
  164. },
  165. "SysInitPath": "/home/kitty/go/src/github.com/dotcloud/docker/bin/docker",
  166. "ResolvConfPath": "/etc/resolv.conf",
  167. "Volumes": {}
  168. }
  169. :statuscode 200: no error
  170. :statuscode 404: no such container
  171. :statuscode 500: server error
  172. Inspect changes on a container's filesystem
  173. *******************************************
  174. .. http:get:: /containers/(id)/changes
  175. Inspect changes on container ``id`` 's filesystem
  176. **Example request**:
  177. .. sourcecode:: http
  178. GET /containers/4fa6e0f0c678/changes HTTP/1.1
  179. **Example response**:
  180. .. sourcecode:: http
  181. HTTP/1.1 200 OK
  182. Content-Type: application/json
  183. [
  184. {
  185. "Path":"/dev",
  186. "Kind":0
  187. },
  188. {
  189. "Path":"/dev/kmsg",
  190. "Kind":1
  191. },
  192. {
  193. "Path":"/test",
  194. "Kind":1
  195. }
  196. ]
  197. :statuscode 200: no error
  198. :statuscode 404: no such container
  199. :statuscode 500: server error
  200. Export a container
  201. ******************
  202. .. http:get:: /containers/(id)/export
  203. Export the contents of container ``id``
  204. **Example request**:
  205. .. sourcecode:: http
  206. GET /containers/4fa6e0f0c678/export HTTP/1.1
  207. **Example response**:
  208. .. sourcecode:: http
  209. HTTP/1.1 200 OK
  210. Content-Type: application/octet-stream
  211. {{ STREAM }}
  212. :statuscode 200: no error
  213. :statuscode 404: no such container
  214. :statuscode 500: server error
  215. Start a container
  216. *****************
  217. .. http:post:: /containers/(id)/start
  218. Start the container ``id``
  219. **Example request**:
  220. .. sourcecode:: http
  221. POST /containers/e90e34656806/start HTTP/1.1
  222. **Example response**:
  223. .. sourcecode:: http
  224. HTTP/1.1 200 OK
  225. :statuscode 200: no error
  226. :statuscode 404: no such container
  227. :statuscode 500: server error
  228. Stop a contaier
  229. ***************
  230. .. http:post:: /containers/(id)/stop
  231. Stop the container ``id``
  232. **Example request**:
  233. .. sourcecode:: http
  234. POST /containers/e90e34656806/stop?t=5 HTTP/1.1
  235. **Example response**:
  236. .. sourcecode:: http
  237. HTTP/1.1 204 OK
  238. :query t: number of seconds to wait before killing the container
  239. :statuscode 204: no error
  240. :statuscode 404: no such container
  241. :statuscode 500: server error
  242. Restart a container
  243. *******************
  244. .. http:post:: /containers/(id)/restart
  245. Restart the container ``id``
  246. **Example request**:
  247. .. sourcecode:: http
  248. POST /containers/e90e34656806/restart?t=5 HTTP/1.1
  249. **Example response**:
  250. .. sourcecode:: http
  251. HTTP/1.1 204 OK
  252. :query t: number of seconds to wait before killing the container
  253. :statuscode 204: no error
  254. :statuscode 404: no such container
  255. :statuscode 500: server error
  256. Kill a container
  257. ****************
  258. .. http:post:: /containers/(id)/kill
  259. Kill the container ``id``
  260. **Example request**:
  261. .. sourcecode:: http
  262. POST /containers/e90e34656806/kill HTTP/1.1
  263. **Example response**:
  264. .. sourcecode:: http
  265. HTTP/1.1 204 OK
  266. :statuscode 204: no error
  267. :statuscode 404: no such container
  268. :statuscode 500: server error
  269. Attach to a container
  270. *********************
  271. .. http:post:: /containers/(id)/attach
  272. Attach to the container ``id``
  273. **Example request**:
  274. .. sourcecode:: http
  275. POST /containers/16253994b7c4/attach?logs=1&stream=0&stdout=1 HTTP/1.1
  276. **Example response**:
  277. .. sourcecode:: http
  278. HTTP/1.1 200 OK
  279. Content-Type: application/vnd.docker.raw-stream
  280. {{ STREAM }}
  281. :query logs: 1/True/true or 0/False/false, return logs. Default false
  282. :query stream: 1/True/true or 0/False/false, return stream. Default false
  283. :query stdin: 1/True/true or 0/False/false, if stream=true, attach to stdin. Default false
  284. :query stdout: 1/True/true or 0/False/false, if logs=true, return stdout log, if stream=true, attach to stdout. Default false
  285. :query stderr: 1/True/true or 0/False/false, if logs=true, return stderr log, if stream=true, attach to stderr. Default false
  286. :statuscode 200: no error
  287. :statuscode 400: bad parameter
  288. :statuscode 404: no such container
  289. :statuscode 500: server error
  290. Wait a container
  291. ****************
  292. .. http:post:: /containers/(id)/wait
  293. Block until container ``id`` stops, then returns the exit code
  294. **Example request**:
  295. .. sourcecode:: http
  296. POST /containers/16253994b7c4/wait HTTP/1.1
  297. **Example response**:
  298. .. sourcecode:: http
  299. HTTP/1.1 200 OK
  300. Content-Type: application/json
  301. {"StatusCode":0}
  302. :statuscode 200: no error
  303. :statuscode 404: no such container
  304. :statuscode 500: server error
  305. Remove a container
  306. *******************
  307. .. http:delete:: /containers/(id)
  308. Remove the container ``id`` from the filesystem
  309. **Example request**:
  310. .. sourcecode:: http
  311. DELETE /containers/16253994b7c4?v=1 HTTP/1.1
  312. **Example response**:
  313. .. sourcecode:: http
  314. HTTP/1.1 204 OK
  315. :query v: 1/True/true or 0/False/false, Remove the volumes associated to the container. Default false
  316. :statuscode 204: no error
  317. :statuscode 400: bad parameter
  318. :statuscode 404: no such container
  319. :statuscode 500: server error
  320. 3.2 Images
  321. ----------
  322. List Images
  323. ***********
  324. .. http:get:: /images/(format)
  325. List images ``format`` could be json or viz (json default)
  326. **Example request**:
  327. .. sourcecode:: http
  328. GET /images/json?all=0 HTTP/1.1
  329. **Example response**:
  330. .. sourcecode:: http
  331. HTTP/1.1 200 OK
  332. Content-Type: application/json
  333. [
  334. {
  335. "Repository":"base",
  336. "Tag":"ubuntu-12.10",
  337. "Id":"b750fe79269d",
  338. "Created":1364102658
  339. },
  340. {
  341. "Repository":"base",
  342. "Tag":"ubuntu-quantal",
  343. "Id":"b750fe79269d",
  344. "Created":1364102658
  345. }
  346. ]
  347. **Example request**:
  348. .. sourcecode:: http
  349. GET /images/viz HTTP/1.1
  350. **Example response**:
  351. .. sourcecode:: http
  352. HTTP/1.1 200 OK
  353. Content-Type: text/plain
  354. digraph docker {
  355. "d82cbacda43a" -> "074be284591f"
  356. "1496068ca813" -> "08306dc45919"
  357. "08306dc45919" -> "0e7893146ac2"
  358. "b750fe79269d" -> "1496068ca813"
  359. base -> "27cf78414709" [style=invis]
  360. "f71189fff3de" -> "9a33b36209ed"
  361. "27cf78414709" -> "b750fe79269d"
  362. "0e7893146ac2" -> "d6434d954665"
  363. "d6434d954665" -> "d82cbacda43a"
  364. base -> "e9aa60c60128" [style=invis]
  365. "074be284591f" -> "f71189fff3de"
  366. "b750fe79269d" [label="b750fe79269d\nbase",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
  367. "e9aa60c60128" [label="e9aa60c60128\nbase2",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
  368. "9a33b36209ed" [label="9a33b36209ed\ntest",shape=box,fillcolor="paleturquoise",style="filled,rounded"];
  369. base [style=invisible]
  370. }
  371. :query all: 1/True/true or 0/False/false, Show all containers. Only running containers are shown by default
  372. :statuscode 200: no error
  373. :statuscode 400: bad parameter
  374. :statuscode 500: server error
  375. Create an image
  376. ***************
  377. .. http:post:: /images/create
  378. Create an image, either by pull it from the registry or by importing it
  379. **Example request v1.0**:
  380. .. sourcecode:: http
  381. POST /images/create?fromImage=base HTTP/1.1
  382. **Example request v1.2**:
  383. .. sourcecode:: http
  384. POST /images/create?fromImage=base HTTP/1.1
  385. {{ authConfig }}
  386. **Example response v1.1**:
  387. .. sourcecode:: http
  388. HTTP/1.1 200 OK
  389. Content-Type: application/json
  390. {"status":"Pulling..."}
  391. {"progress":"1/? (n/a)"}
  392. {"error":"Invalid..."}
  393. ...
  394. **Example response v1.0**:
  395. .. sourcecode:: http
  396. HTTP/1.1 200 OK
  397. Content-Type: application/vnd.docker.raw-stream
  398. {{ STREAM }}
  399. :query fromImage: name of the image to pull
  400. :query fromSrc: source to import, - means stdin
  401. :query repo: repository
  402. :query tag: tag
  403. :query registry: the registry to pull from
  404. :statuscode 200: no error
  405. :statuscode 500: server error
  406. Insert a file in a image
  407. ************************
  408. .. http:post:: /images/(name)/insert
  409. Insert a file from ``url`` in the image ``name`` at ``path``
  410. **Example request**:
  411. .. sourcecode:: http
  412. POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
  413. **Example response v1.1**:
  414. .. sourcecode:: http
  415. HTTP/1.1 200 OK
  416. Content-Type: application/json
  417. {"status":"Inserting..."}
  418. {"progress":"1/? (n/a)"}
  419. {"error":"Invalid..."}
  420. ...
  421. **Example response v1.0**:
  422. .. sourcecode:: http
  423. HTTP/1.1 200 OK
  424. {{ STREAM }}
  425. :statuscode 200: no error
  426. :statuscode 500: server error
  427. Inspect an image
  428. ****************
  429. .. http:get:: /images/(name)/json
  430. Return low-level information on the image ``name``
  431. **Example request**:
  432. .. sourcecode:: http
  433. GET /images/base/json HTTP/1.1
  434. **Example response**:
  435. .. sourcecode:: http
  436. HTTP/1.1 200 OK
  437. Content-Type: application/json
  438. {
  439. "id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  440. "parent":"27cf784147099545",
  441. "created":"2013-03-23T22:24:18.818426-07:00",
  442. "container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  443. "container_config":
  444. {
  445. "Hostname":"",
  446. "User":"",
  447. "Memory":0,
  448. "MemorySwap":0,
  449. "AttachStdin":false,
  450. "AttachStdout":false,
  451. "AttachStderr":false,
  452. "PortSpecs":null,
  453. "Tty":true,
  454. "OpenStdin":true,
  455. "StdinOnce":false,
  456. "Env":null,
  457. "Cmd": ["/bin/bash"]
  458. ,"Dns":null,
  459. "Image":"base",
  460. "Volumes":null,
  461. "VolumesFrom":""
  462. }
  463. }
  464. :statuscode 200: no error
  465. :statuscode 404: no such image
  466. :statuscode 500: server error
  467. Get the history of an image
  468. ***************************
  469. .. http:get:: /images/(name)/history
  470. Return the history of the image ``name``
  471. **Example request**:
  472. .. sourcecode:: http
  473. GET /images/base/history HTTP/1.1
  474. **Example response**:
  475. .. sourcecode:: http
  476. HTTP/1.1 200 OK
  477. Content-Type: application/json
  478. [
  479. {
  480. "Id":"b750fe79269d",
  481. "Created":1364102658,
  482. "CreatedBy":"/bin/bash"
  483. },
  484. {
  485. "Id":"27cf78414709",
  486. "Created":1364068391,
  487. "CreatedBy":""
  488. }
  489. ]
  490. :statuscode 200: no error
  491. :statuscode 404: no such image
  492. :statuscode 500: server error
  493. Push an image on the registry
  494. *****************************
  495. .. http:post:: /images/(name)/push
  496. Push the image ``name`` on the registry
  497. **Example request v1.0**:
  498. .. sourcecode:: http
  499. POST /images/test/push HTTP/1.1
  500. **Example request v1.2**:
  501. .. sourcecode:: http
  502. POST /images/test/push HTTP/1.1
  503. {{ authConfig }}
  504. **Example response v1.1**:
  505. .. sourcecode:: http
  506. HTTP/1.1 200 OK
  507. Content-Type: application/json
  508. {"status":"Pushing..."}
  509. {"progress":"1/? (n/a)"}
  510. {"error":"Invalid..."}
  511. ...
  512. **Example response v1.0**:
  513. .. sourcecode:: http
  514. HTTP/1.1 200 OK
  515. Content-Type: application/vnd.docker.raw-stream
  516. {{ STREAM }}
  517. :query registry: the registry you wan to push, optional
  518. :statuscode 200: no error
  519. :statuscode 404: no such image
  520. :statuscode 500: server error
  521. Tag an image into a repository
  522. ******************************
  523. .. http:post:: /images/(name)/tag
  524. Tag the image ``name`` into a repository
  525. **Example request**:
  526. .. sourcecode:: http
  527. POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
  528. **Example response**:
  529. .. sourcecode:: http
  530. HTTP/1.1 200 OK
  531. :query repo: The repository to tag in
  532. :query force: 1/True/true or 0/False/false, default false
  533. :statuscode 200: no error
  534. :statuscode 400: bad parameter
  535. :statuscode 404: no such image
  536. :statuscode 500: server error
  537. Remove an image
  538. ***************
  539. .. http:delete:: /images/(name)
  540. Remove the image ``name`` from the filesystem
  541. **Example request**:
  542. .. sourcecode:: http
  543. DELETE /images/test HTTP/1.1
  544. **Example response**:
  545. .. sourcecode:: http
  546. HTTP/1.1 204 OK
  547. :statuscode 204: no error
  548. :statuscode 404: no such image
  549. :statuscode 500: server error
  550. Search images
  551. *************
  552. .. http:get:: /images/search
  553. Search for an image in the docker index
  554. **Example request**:
  555. .. sourcecode:: http
  556. GET /images/search?term=sshd HTTP/1.1
  557. **Example response**:
  558. .. sourcecode:: http
  559. HTTP/1.1 200 OK
  560. Content-Type: application/json
  561. [
  562. {
  563. "Name":"cespare/sshd",
  564. "Description":""
  565. },
  566. {
  567. "Name":"johnfuller/sshd",
  568. "Description":""
  569. },
  570. {
  571. "Name":"dhrp/mongodb-sshd",
  572. "Description":""
  573. }
  574. ]
  575. :query term: term to search
  576. :statuscode 200: no error
  577. :statuscode 500: server error
  578. 3.3 Misc
  579. --------
  580. Build an image from Dockerfile via stdin
  581. ****************************************
  582. .. http:post:: /build
  583. Build an image from Dockerfile via stdin
  584. **Example request**:
  585. .. sourcecode:: http
  586. POST /build HTTP/1.1
  587. {{ STREAM }}
  588. **Example response**:
  589. .. sourcecode:: http
  590. HTTP/1.1 200 OK
  591. {{ STREAM }}
  592. :query t: tag to be applied to the resulting image in case of success
  593. :statuscode 200: no error
  594. :statuscode 500: server error
  595. Get default username and email <deprecated with 1.2>
  596. ******************************
  597. .. http:get:: /auth
  598. Get the default username and email
  599. **Example request**:
  600. .. sourcecode:: http
  601. GET /auth HTTP/1.1
  602. **Example response**:
  603. .. sourcecode:: http
  604. HTTP/1.1 200 OK
  605. Content-Type: application/json
  606. {
  607. "username":"hannibal",
  608. "email":"hannibal@a-team.com"
  609. }
  610. :statuscode 200: no error
  611. :statuscode 500: server error
  612. Check auth configuration (and store if if api < 1.2)
  613. ****************************************************
  614. .. http:post:: /auth
  615. Get the default username and email
  616. **Example request**:
  617. .. sourcecode:: http
  618. POST /auth HTTP/1.1
  619. Content-Type: application/json
  620. {
  621. "username":"hannibal",
  622. "password:"xxxx",
  623. "email":"hannibal@a-team.com"
  624. }
  625. **Example response**:
  626. .. sourcecode:: http
  627. HTTP/1.1 200 OK
  628. :statuscode 200: no error
  629. :statuscode 204: no error
  630. :statuscode 500: server error
  631. Display system-wide information
  632. *******************************
  633. .. http:get:: /info
  634. Display system-wide information
  635. **Example request**:
  636. .. sourcecode:: http
  637. GET /info HTTP/1.1
  638. **Example response**:
  639. .. sourcecode:: http
  640. HTTP/1.1 200 OK
  641. Content-Type: application/json
  642. {
  643. "Containers":11,
  644. "Version":"0.2.2",
  645. "Images":16,
  646. "GoVersion":"go1.0.3",
  647. "Debug":false
  648. }
  649. :statuscode 200: no error
  650. :statuscode 500: server error
  651. Show the docker version information
  652. ***********************************
  653. .. http:get:: /version
  654. Show the docker version information
  655. **Example request**:
  656. .. sourcecode:: http
  657. GET /version HTTP/1.1
  658. **Example response**:
  659. .. sourcecode:: http
  660. HTTP/1.1 200 OK
  661. Content-Type: application/json
  662. {
  663. "Version":"0.2.2",
  664. "GitCommit":"5a2a5cc+CHANGES",
  665. "MemoryLimit":true,
  666. "SwapLimit":false
  667. }
  668. :statuscode 200: no error
  669. :statuscode 500: server error
  670. Create a new image from a container's changes
  671. *********************************************
  672. .. http:post:: /commit
  673. Create a new image from a container's changes
  674. **Example request**:
  675. .. sourcecode:: http
  676. POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
  677. **Example response**:
  678. .. sourcecode:: http
  679. HTTP/1.1 201 OK
  680. Content-Type: application/vnd.docker.raw-stream
  681. {"Id":"596069db4bf5"}
  682. :query container: source container
  683. :query repo: repository
  684. :query tag: tag
  685. :query m: commit message
  686. :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>")
  687. :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
  688. :statuscode 201: no error
  689. :statuscode 404: no such container
  690. :statuscode 500: server error
  691. 3. Going further
  692. ================
  693. 3.1 Inside 'docker run'
  694. -----------------------
  695. Here are the steps of 'docker run' :
  696. * Create the container
  697. * If the status code is 404, it means the image doesn't exists:
  698. * Try to pull it
  699. * Then retry to create the container
  700. * Start the container
  701. * If you are not in detached mode:
  702. * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1
  703. * If in detached mode or only stdin is attached:
  704. * Display the container's id
  705. 3.2 Hijacking
  706. -------------
  707. In this first version of the API, some of the endpoints, like /attach, /pull or /push uses hijacking to transport stdin,
  708. stdout and stderr on the same socket. This might change in the future.