docker_remote_api.rst 19 KB

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