docker_remote_api.rst 21 KB

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