docker_remote_api.rst 19 KB

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