api.rst 19 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  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
  17. List containers
  18. **Example request**:
  19. .. sourcecode:: http
  20. GET /containers?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
  66. Create a container
  67. **Example request**:
  68. .. sourcecode:: http
  69. POST /containers 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/vnd.docker.raw-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:: /container/(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
  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&only_ids=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 only_ids: 1 or 0, Only display numeric IDs. Default 0
  361. :query all: 1 or 0, Show all containers. Only running containers are shown by default
  362. :statuscode 200: no error
  363. :statuscode 500: server error
  364. Create an image
  365. ***************
  366. .. http:post:: /images
  367. Create an image, either by pull it from the registry or by importing it
  368. **Example request**:
  369. .. sourcecode:: http
  370. POST /images?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)
  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 or 0, default 0
  490. :statuscode 200: no error
  491. :statuscode 404: no such image
  492. :statuscode 500: server error
  493. Remove an image
  494. ***************
  495. .. http:delete:: /images/(name)
  496. Remove the image ``name`` from the filesystem
  497. **Example request**:
  498. .. sourcecode:: http
  499. DELETE /images/test HTTP/1.1
  500. **Example response**:
  501. .. sourcecode:: http
  502. HTTP/1.1 204 OK
  503. :statuscode 204: no error
  504. :statuscode 404: no such image
  505. :statuscode 500: server error
  506. Search images
  507. *************
  508. .. http:get:: /images/search
  509. Search for an image in the docker index
  510. **Example request**:
  511. .. sourcecode:: http
  512. GET /images/search?term=sshd HTTP/1.1
  513. **Example response**:
  514. .. sourcecode:: http
  515. HTTP/1.1 200 OK
  516. Content-Type: application/json
  517. [
  518. {
  519. "Name":"cespare/sshd",
  520. "Description":""
  521. },
  522. {
  523. "Name":"johnfuller/sshd",
  524. "Description":""
  525. },
  526. {
  527. "Name":"dhrp/mongodb-sshd",
  528. "Description":""
  529. }
  530. ]
  531. :query term: term to search
  532. :statuscode 200: no error
  533. :statuscode 500: server error
  534. 2.3 Misc
  535. --------
  536. Build an image from Dockerfile via stdin
  537. ****************************************
  538. .. http:post:: /build
  539. Build an image from Dockerfile via stdin
  540. **Example request**:
  541. .. sourcecode:: http
  542. POST /build HTTP/1.1
  543. {{ STREAM }}
  544. **Example response**:
  545. .. sourcecode:: http
  546. HTTP/1.1 200 OK
  547. {{ STREAM }}
  548. :statuscode 200: no error
  549. :statuscode 500: server error
  550. Get default username and email
  551. ******************************
  552. .. http:get:: /auth
  553. Get the default username and email
  554. **Example request**:
  555. .. sourcecode:: http
  556. GET /auth HTTP/1.1
  557. **Example response**:
  558. .. sourcecode:: http
  559. HTTP/1.1 200 OK
  560. Content-Type: application/json
  561. {
  562. "username":"hannibal",
  563. "email":"hannibal@a-team.com"
  564. }
  565. :statuscode 200: no error
  566. :statuscode 500: server error
  567. Set auth configuration
  568. **********************
  569. .. http:post:: /auth
  570. Get the default username and email
  571. **Example request**:
  572. .. sourcecode:: http
  573. POST /auth HTTP/1.1
  574. Content-Type: application/json
  575. {
  576. "username":"hannibal",
  577. "password:"xxxx",
  578. "email":"hannibal@a-team.com"
  579. }
  580. **Example response**:
  581. .. sourcecode:: http
  582. HTTP/1.1 200 OK
  583. :statuscode 200: no error
  584. :statuscode 204: no error
  585. :statuscode 500: server error
  586. Display system-wide information
  587. *******************************
  588. .. http:get:: /info
  589. Display system-wide information
  590. **Example request**:
  591. .. sourcecode:: http
  592. GET /info HTTP/1.1
  593. **Example response**:
  594. .. sourcecode:: http
  595. HTTP/1.1 200 OK
  596. Content-Type: application/json
  597. {
  598. "Containers":11,
  599. "Version":"0.2.2",
  600. "Images":16,
  601. "GoVersion":"go1.0.3",
  602. "Debug":false
  603. }
  604. :statuscode 200: no error
  605. :statuscode 500: server error
  606. Show the docker version information
  607. ***********************************
  608. .. http:get:: /version
  609. Show the docker version information
  610. **Example request**:
  611. .. sourcecode:: http
  612. GET /version HTTP/1.1
  613. **Example response**:
  614. .. sourcecode:: http
  615. HTTP/1.1 200 OK
  616. Content-Type: application/json
  617. {
  618. "Version":"0.2.2",
  619. "GitCommit":"5a2a5cc+CHANGES",
  620. "MemoryLimit":true,
  621. "SwapLimit":false
  622. }
  623. :statuscode 200: no error
  624. :statuscode 500: server error
  625. Create a new image from a container's changes
  626. *********************************************
  627. .. http:post:: /commit
  628. Create a new image from a container's changes
  629. **Example request**:
  630. .. sourcecode:: http
  631. POST /commit?container=44c004db4b17&m=message&repo=myrepo HTTP/1.1
  632. **Example response**:
  633. .. sourcecode:: http
  634. HTTP/1.1 201 OK
  635. Content-Type: application/vnd.docker.raw-stream
  636. {"Id":"596069db4bf5"}
  637. :query container: source container
  638. :query repo: repository
  639. :query tag: tag
  640. :query m: commit message
  641. :query author: author (eg. "John Hannibal Smith <hannibal@a-team.com>")
  642. :query run: config automatically applied when the image is run. (ex: {"Cmd": ["cat", "/world"], "PortSpecs":["22"]})
  643. :statuscode 201: no error
  644. :statuscode 404: no such container
  645. :statuscode 500: server error
  646. 3. Going further
  647. ================
  648. 3.1 Inside 'docker run'
  649. -----------------------
  650. Here are the steps of 'docker run' :
  651. * Create the container
  652. * If the status code is 404, it means the image doesn't exists:
  653. * Try to pull it
  654. * Then retry to create the container
  655. * Start the container
  656. * If you are not in detached mode:
  657. * Attach to the container, using logs=1 (to have stdout and stderr from the container's start) and stream=1
  658. * If in detached mode or only stdin is attached:
  659. * Display the container's id
  660. 3.2 Hijacking
  661. -------------
  662. In this first version of the API, some of the endpoints, like /attach, /pull or /push uses hijacking to transport stdin,
  663. stdout and stderr on the same socket. This might change in the future.