docker_remote_api_v1.2.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  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: repository name 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. Content-Type: application/json
  613. {
  614. "Status": "Login Succeeded"
  615. }
  616. :statuscode 200: no error
  617. :statuscode 204: no error
  618. :statuscode 401: unauthorized
  619. :statuscode 403: forbidden
  620. :statuscode 500: server error
  621. Display system-wide information
  622. *******************************
  623. .. http:get:: /info
  624. Display system-wide information
  625. **Example request**:
  626. .. sourcecode:: http
  627. GET /info HTTP/1.1
  628. **Example response**:
  629. .. sourcecode:: http
  630. HTTP/1.1 200 OK
  631. Content-Type: application/json
  632. {
  633. "Containers":11,
  634. "Images":16,
  635. "Debug":false,
  636. "NFd": 11,
  637. "NGoroutines":21,
  638. "MemoryLimit":true,
  639. "SwapLimit":false
  640. }
  641. :statuscode 200: no error
  642. :statuscode 500: server error
  643. Show the docker version information
  644. ***********************************
  645. .. http:get:: /version
  646. Show the docker version information
  647. **Example request**:
  648. .. sourcecode:: http
  649. GET /version HTTP/1.1
  650. **Example response**:
  651. .. sourcecode:: http
  652. HTTP/1.1 200 OK
  653. Content-Type: application/json
  654. {
  655. "Version":"0.2.2",
  656. "GitCommit":"5a2a5cc+CHANGES",
  657. "GoVersion":"go1.0.3"
  658. }
  659. :statuscode 200: no error
  660. :statuscode 500: server error
  661. Create a new image from a container's changes
  662. *********************************************
  663. .. http:post:: /commit
  664. Create a new image from a container's changes
  665. **Example request**:
  666. .. sourcecode:: http
  667. POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
  668. **Example response**:
  669. .. sourcecode:: http
  670. HTTP/1.1 201 OK
  671. Content-Type: application/vnd.docker.raw-stream
  672. {"Id":"596069db4bf5"}
  673. :query container: source container
  674. :query repo: repository
  675. :query tag: tag
  676. :query m: commit message
  677. :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>")
  678. :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
  679. :statuscode 201: no error
  680. :statuscode 404: no such container
  681. :statuscode 500: server error
  682. 3. Going further
  683. ================
  684. 3.1 Inside 'docker run'
  685. -----------------------
  686. Here are the steps of 'docker run' :
  687. * Create the container
  688. * If the status code is 404, it means the image doesn't exists:
  689. * Try to pull it
  690. * Then retry to create the container
  691. * Start the container
  692. * If you are not in detached mode:
  693. * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1
  694. * If in detached mode or only stdin is attached:
  695. * Display the container's id
  696. 3.2 Hijacking
  697. -------------
  698. 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.
  699. 3.3 CORS Requests
  700. -----------------
  701. To enable cross origin requests to the remote api add the flag "-api-enable-cors" when running docker in daemon mode.
  702. docker -d -H="tcp://192.168.1.9:4243" -api-enable-cors