docker_remote_api.rst 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091
  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. {"status":"Pulling", "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. {"status":"Inserting", "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. {"status":"Pushing", "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 500: server error
  528. Remove an image
  529. ***************
  530. .. http:delete:: /images/(name)
  531. Remove the image ``name`` from the filesystem
  532. **Example request**:
  533. .. sourcecode:: http
  534. DELETE /images/test HTTP/1.1
  535. **Example response**:
  536. .. sourcecode:: http
  537. HTTP/1.1 204 OK
  538. :statuscode 204: no error
  539. :statuscode 404: no such image
  540. :statuscode 500: server error
  541. Search images
  542. *************
  543. .. http:get:: /images/search
  544. Search for an image in the docker index
  545. **Example request**:
  546. .. sourcecode:: http
  547. GET /images/search?term=sshd HTTP/1.1
  548. **Example response**:
  549. .. sourcecode:: http
  550. HTTP/1.1 200 OK
  551. Content-Type: application/json
  552. [
  553. {
  554. "Name":"cespare/sshd",
  555. "Description":""
  556. },
  557. {
  558. "Name":"johnfuller/sshd",
  559. "Description":""
  560. },
  561. {
  562. "Name":"dhrp/mongodb-sshd",
  563. "Description":""
  564. }
  565. ]
  566. :query term: term to search
  567. :statuscode 200: no error
  568. :statuscode 500: server error
  569. 3.3 Misc
  570. --------
  571. Build an image from Dockerfile via stdin
  572. ****************************************
  573. .. http:post:: /build
  574. Build an image from Dockerfile via stdin
  575. **Example request**:
  576. .. sourcecode:: http
  577. POST /build HTTP/1.1
  578. {{ STREAM }}
  579. **Example response**:
  580. .. sourcecode:: http
  581. HTTP/1.1 200 OK
  582. {{ STREAM }}
  583. :query t: tag to be applied to the resulting image in case of success
  584. :statuscode 200: no error
  585. :statuscode 500: server error
  586. Get default username and email
  587. ******************************
  588. .. http:get:: /auth
  589. Get the default username and email
  590. **Example request**:
  591. .. sourcecode:: http
  592. GET /auth HTTP/1.1
  593. **Example response**:
  594. .. sourcecode:: http
  595. HTTP/1.1 200 OK
  596. Content-Type: application/json
  597. {
  598. "username":"hannibal",
  599. "email":"hannibal@a-team.com"
  600. }
  601. :statuscode 200: no error
  602. :statuscode 500: server error
  603. Set auth configuration
  604. **********************
  605. .. http:post:: /auth
  606. Get the default username and email
  607. **Example request**:
  608. .. sourcecode:: http
  609. POST /auth HTTP/1.1
  610. Content-Type: application/json
  611. {
  612. "username":"hannibal",
  613. "password:"xxxx",
  614. "email":"hannibal@a-team.com"
  615. }
  616. **Example response**:
  617. .. sourcecode:: http
  618. HTTP/1.1 200 OK
  619. :statuscode 200: no error
  620. :statuscode 204: no error
  621. :statuscode 500: server error
  622. Display system-wide information
  623. *******************************
  624. .. http:get:: /info
  625. Display system-wide information
  626. **Example request**:
  627. .. sourcecode:: http
  628. GET /info HTTP/1.1
  629. **Example response**:
  630. .. sourcecode:: http
  631. HTTP/1.1 200 OK
  632. Content-Type: application/json
  633. {
  634. "Containers":11,
  635. "Images":16,
  636. "Debug":false,
  637. "NFd": 11,
  638. "NGoroutines":21,
  639. "MemoryLimit":true,
  640. "SwapLimit":false
  641. }
  642. :statuscode 200: no error
  643. :statuscode 500: server error
  644. Show the docker version information
  645. ***********************************
  646. .. http:get:: /version
  647. Show the docker version information
  648. **Example request**:
  649. .. sourcecode:: http
  650. GET /version HTTP/1.1
  651. **Example response**:
  652. .. sourcecode:: http
  653. HTTP/1.1 200 OK
  654. Content-Type: application/json
  655. {
  656. "Version":"0.2.2",
  657. "GitCommit":"5a2a5cc+CHANGES",
  658. "GoVersion":"go1.0.3"
  659. }
  660. :statuscode 200: no error
  661. :statuscode 500: server error
  662. Create a new image from a container's changes
  663. *********************************************
  664. .. http:post:: /commit
  665. Create a new image from a container's changes
  666. **Example request**:
  667. .. sourcecode:: http
  668. POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
  669. **Example response**:
  670. .. sourcecode:: http
  671. HTTP/1.1 201 OK
  672. Content-Type: application/vnd.docker.raw-stream
  673. {"Id":"596069db4bf5"}
  674. :query container: source container
  675. :query repo: repository
  676. :query tag: tag
  677. :query m: commit message
  678. :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>")
  679. :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
  680. :statuscode 201: no error
  681. :statuscode 404: no such container
  682. :statuscode 500: server error
  683. 3. Going further
  684. ================
  685. 3.1 Inside 'docker run'
  686. -----------------------
  687. Here are the steps of 'docker run' :
  688. * Create the container
  689. * If the status code is 404, it means the image doesn't exists:
  690. * Try to pull it
  691. * Then retry to create the container
  692. * Start the container
  693. * If you are not in detached mode:
  694. * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1
  695. * If in detached mode or only stdin is attached:
  696. * Display the container's id
  697. 3.2 Hijacking
  698. -------------
  699. In this first version of the API, some of the endpoints, like /attach, /pull or /push uses hijacking to transport stdin,
  700. stdout and stderr on the same socket. This might change in the future.
  701. 3.3 CORS Requests
  702. -----------------
  703. To enable cross origin requests to the remote api add the flag "-api-enable-cors" when running docker in daemon mode.
  704. docker -d -H="192.168.1.9:4243" -api-enable-cors
  705. ==================================
  706. Docker Remote API Client Libraries
  707. ==================================
  708. These libraries have been not tested by the Docker Maintainers for
  709. compatibility. Please file issues with the library owners. If you
  710. find more library implementations, please list them in Docker doc bugs
  711. and we will add the libraries here.
  712. +----------------------+----------------+--------------------------------------------+
  713. | Language/Framework | Name | Repository |
  714. +======================+================+============================================+
  715. | Python | docker-py | https://github.com/dotcloud/docker-py |
  716. +----------------------+----------------+--------------------------------------------+
  717. | Ruby | docker-ruby | https://github.com/ActiveState/docker-ruby |
  718. +----------------------+----------------+--------------------------------------------+
  719. | Ruby | docker-client | https://github.com/geku/docker-client |
  720. +----------------------+----------------+--------------------------------------------+
  721. | Javascript | docker-js | https://github.com/dgoujard/docker-js |
  722. +----------------------+----------------+--------------------------------------------+
  723. | Javascript (Angular) | dockerui | https://github.com/crosbymichael/dockerui |
  724. | **WebUI** | | |
  725. +----------------------+----------------+--------------------------------------------+