docker_remote_api.rst 19 KB

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