docker_remote_api_v1.3.rst 21 KB

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