api.rst 19 KB

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