docker_remote_api_v1.2.rst 20 KB

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