docker_remote_api.rst 19 KB

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