api.rst 19 KB

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