docker_remote_api_v1.3.rst 21 KB

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