docker_remote_api.rst 21 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  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
  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**:
  380. .. sourcecode:: http
  381. POST /images/create?fromImage=base HTTP/1.1
  382. **Example response v1.1**:
  383. .. sourcecode:: http
  384. HTTP/1.1 200 OK
  385. Content-Type: application/json
  386. {"status":"Pulling..."}
  387. {"progress":"1/? (n/a)"}
  388. {"error":"Invalid..."}
  389. ...
  390. **Example response v1.0**:
  391. .. sourcecode:: http
  392. HTTP/1.1 200 OK
  393. Content-Type: application/vnd.docker.raw-stream
  394. {{ STREAM }}
  395. :query fromImage: name of the image to pull
  396. :query fromSrc: source to import, - means stdin
  397. :query repo: repository
  398. :query tag: tag
  399. :query registry: the registry to pull from
  400. :statuscode 200: no error
  401. :statuscode 500: server error
  402. Insert a file in a image
  403. ************************
  404. .. http:post:: /images/(name)/insert
  405. Insert a file from ``url`` in the image ``name`` at ``path``
  406. **Example request**:
  407. .. sourcecode:: http
  408. POST /images/test/insert?path=/usr&url=myurl HTTP/1.1
  409. **Example response v1.1**:
  410. .. sourcecode:: http
  411. HTTP/1.1 200 OK
  412. Content-Type: application/json
  413. {"status":"Inserting..."}
  414. {"progress":"1/? (n/a)"}
  415. {"error":"Invalid..."}
  416. ...
  417. **Example response v1.0**:
  418. .. sourcecode:: http
  419. HTTP/1.1 200 OK
  420. {{ STREAM }}
  421. :statuscode 200: no error
  422. :statuscode 500: server error
  423. Inspect an image
  424. ****************
  425. .. http:get:: /images/(name)/json
  426. Return low-level information on the image ``name``
  427. **Example request**:
  428. .. sourcecode:: http
  429. GET /images/base/json HTTP/1.1
  430. **Example response**:
  431. .. sourcecode:: http
  432. HTTP/1.1 200 OK
  433. Content-Type: application/json
  434. {
  435. "id":"b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc",
  436. "parent":"27cf784147099545",
  437. "created":"2013-03-23T22:24:18.818426-07:00",
  438. "container":"3d67245a8d72ecf13f33dffac9f79dcdf70f75acb84d308770391510e0c23ad0",
  439. "container_config":
  440. {
  441. "Hostname":"",
  442. "User":"",
  443. "Memory":0,
  444. "MemorySwap":0,
  445. "AttachStdin":false,
  446. "AttachStdout":false,
  447. "AttachStderr":false,
  448. "PortSpecs":null,
  449. "Tty":true,
  450. "OpenStdin":true,
  451. "StdinOnce":false,
  452. "Env":null,
  453. "Cmd": ["/bin/bash"]
  454. ,"Dns":null,
  455. "Image":"base",
  456. "Volumes":null,
  457. "VolumesFrom":""
  458. }
  459. }
  460. :statuscode 200: no error
  461. :statuscode 404: no such image
  462. :statuscode 500: server error
  463. Get the history of an image
  464. ***************************
  465. .. http:get:: /images/(name)/history
  466. Return the history of the image ``name``
  467. **Example request**:
  468. .. sourcecode:: http
  469. GET /images/base/history HTTP/1.1
  470. **Example response**:
  471. .. sourcecode:: http
  472. HTTP/1.1 200 OK
  473. Content-Type: application/json
  474. [
  475. {
  476. "Id":"b750fe79269d",
  477. "Created":1364102658,
  478. "CreatedBy":"/bin/bash"
  479. },
  480. {
  481. "Id":"27cf78414709",
  482. "Created":1364068391,
  483. "CreatedBy":""
  484. }
  485. ]
  486. :statuscode 200: no error
  487. :statuscode 404: no such image
  488. :statuscode 500: server error
  489. Push an image on the registry
  490. *****************************
  491. .. http:post:: /images/(name)/push
  492. Push the image ``name`` on the registry
  493. **Example request v1.0**:
  494. .. sourcecode:: http
  495. POST /images/test/push HTTP/1.1
  496. **Example request v1.2**:
  497. .. sourcecode:: http
  498. POST /images/test/push HTTP/1.1
  499. {{ authConfig }}
  500. **Example response v1.1**:
  501. .. sourcecode:: http
  502. HTTP/1.1 200 OK
  503. Content-Type: application/json
  504. {"status":"Pushing..."}
  505. {"progress":"1/? (n/a)"}
  506. {"error":"Invalid..."}
  507. ...
  508. **Example response v1.0**:
  509. .. sourcecode:: http
  510. HTTP/1.1 200 OK
  511. Content-Type: application/vnd.docker.raw-stream
  512. {{ STREAM }}
  513. :query registry: the registry you wan to push, optional
  514. :statuscode 200: no error
  515. :statuscode 404: no such image
  516. :statuscode 500: server error
  517. Tag an image into a repository
  518. ******************************
  519. .. http:post:: /images/(name)/tag
  520. Tag the image ``name`` into a repository
  521. **Example request**:
  522. .. sourcecode:: http
  523. POST /images/test/tag?repo=myrepo&force=0 HTTP/1.1
  524. **Example response**:
  525. .. sourcecode:: http
  526. HTTP/1.1 200 OK
  527. :query repo: The repository to tag in
  528. :query force: 1/True/true or 0/False/false, default false
  529. :statuscode 200: no error
  530. :statuscode 400: bad parameter
  531. :statuscode 404: no such image
  532. :statuscode 500: server error
  533. Remove an image
  534. ***************
  535. .. http:delete:: /images/(name)
  536. Remove the image ``name`` from the filesystem
  537. **Example request**:
  538. .. sourcecode:: http
  539. DELETE /images/test HTTP/1.1
  540. **Example response**:
  541. .. sourcecode:: http
  542. HTTP/1.1 204 OK
  543. :statuscode 204: no error
  544. :statuscode 404: no such image
  545. :statuscode 500: server error
  546. Search images
  547. *************
  548. .. http:get:: /images/search
  549. Search for an image in the docker index
  550. **Example request**:
  551. .. sourcecode:: http
  552. GET /images/search?term=sshd HTTP/1.1
  553. **Example response**:
  554. .. sourcecode:: http
  555. HTTP/1.1 200 OK
  556. Content-Type: application/json
  557. [
  558. {
  559. "Name":"cespare/sshd",
  560. "Description":""
  561. },
  562. {
  563. "Name":"johnfuller/sshd",
  564. "Description":""
  565. },
  566. {
  567. "Name":"dhrp/mongodb-sshd",
  568. "Description":""
  569. }
  570. ]
  571. :query term: term to search
  572. :statuscode 200: no error
  573. :statuscode 500: server error
  574. 3.3 Misc
  575. --------
  576. Build an image from Dockerfile via stdin
  577. ****************************************
  578. .. http:post:: /build
  579. Build an image from Dockerfile via stdin
  580. **Example request**:
  581. .. sourcecode:: http
  582. POST /build HTTP/1.1
  583. {{ STREAM }}
  584. **Example response**:
  585. .. sourcecode:: http
  586. HTTP/1.1 200 OK
  587. {{ STREAM }}
  588. :query t: tag to be applied to the resulting image in case of success
  589. :statuscode 200: no error
  590. :statuscode 500: server error
  591. Get default username and email <deprecated with 1.2>
  592. ******************************
  593. .. http:get:: /auth
  594. Get the default username and email
  595. **Example request**:
  596. .. sourcecode:: http
  597. GET /auth HTTP/1.1
  598. **Example response**:
  599. .. sourcecode:: http
  600. HTTP/1.1 200 OK
  601. Content-Type: application/json
  602. {
  603. "username":"hannibal",
  604. "email":"hannibal@a-team.com"
  605. }
  606. :statuscode 200: no error
  607. :statuscode 500: server error
  608. Check auth configuration (and store if if api < 1.2)
  609. ****************************************************
  610. .. http:post:: /auth
  611. Get the default username and email
  612. **Example request**:
  613. .. sourcecode:: http
  614. POST /auth HTTP/1.1
  615. Content-Type: application/json
  616. {
  617. "username":"hannibal",
  618. "password:"xxxx",
  619. "email":"hannibal@a-team.com"
  620. }
  621. **Example response**:
  622. .. sourcecode:: http
  623. HTTP/1.1 200 OK
  624. :statuscode 200: no error
  625. :statuscode 204: no error
  626. :statuscode 500: server error
  627. Display system-wide information
  628. *******************************
  629. .. http:get:: /info
  630. Display system-wide information
  631. **Example request**:
  632. .. sourcecode:: http
  633. GET /info HTTP/1.1
  634. **Example response**:
  635. .. sourcecode:: http
  636. HTTP/1.1 200 OK
  637. Content-Type: application/json
  638. {
  639. "Containers":11,
  640. "Images":16,
  641. "Debug":false,
  642. "NFd": 11,
  643. "NGoroutines":21,
  644. "MemoryLimit":true,
  645. "SwapLimit":false
  646. }
  647. :statuscode 200: no error
  648. :statuscode 500: server error
  649. Show the docker version information
  650. ***********************************
  651. .. http:get:: /version
  652. Show the docker version information
  653. **Example request**:
  654. .. sourcecode:: http
  655. GET /version HTTP/1.1
  656. **Example response**:
  657. .. sourcecode:: http
  658. HTTP/1.1 200 OK
  659. Content-Type: application/json
  660. {
  661. "Version":"0.2.2",
  662. "GitCommit":"5a2a5cc+CHANGES",
  663. "GoVersion":"go1.0.3"
  664. }
  665. :statuscode 200: no error
  666. :statuscode 500: server error
  667. Create a new image from a container's changes
  668. *********************************************
  669. .. http:post:: /commit
  670. Create a new image from a container's changes
  671. **Example request**:
  672. .. sourcecode:: http
  673. POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
  674. **Example response**:
  675. .. sourcecode:: http
  676. HTTP/1.1 201 OK
  677. Content-Type: application/vnd.docker.raw-stream
  678. {"Id":"596069db4bf5"}
  679. :query container: source container
  680. :query repo: repository
  681. :query tag: tag
  682. :query m: commit message
  683. :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>")
  684. :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
  685. :statuscode 201: no error
  686. :statuscode 404: no such container
  687. :statuscode 500: server error
  688. 3. Going further
  689. ================
  690. 3.1 Inside 'docker run'
  691. -----------------------
  692. Here are the steps of 'docker run' :
  693. * Create the container
  694. * If the status code is 404, it means the image doesn't exists:
  695. * Try to pull it
  696. * Then retry to create the container
  697. * Start the container
  698. * If you are not in detached mode:
  699. * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1
  700. * If in detached mode or only stdin is attached:
  701. * Display the container's id
  702. 3.2 Hijacking
  703. -------------
  704. In this first version of the API, some of the endpoints, like /attach, /pull or /push uses hijacking to transport stdin,
  705. stdout and stderr on the same socket. This might change in the future.