docker_remote_api_v1.1.rst 20 KB

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