docker_remote_api_v1.2.rst 20 KB

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