docker_remote_api.rst 19 KB

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