docker_remote_api.rst 22 KB

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