cli.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. :title: Command Line Interface
  2. :description: Docker's CLI command description and usage
  3. :keywords: Docker, Docker documentation, CLI, command line
  4. .. _cli:
  5. Command Line Interface
  6. ======================
  7. Docker Usage
  8. ~~~~~~~~~~~~
  9. ::
  10. $ docker
  11. Usage: docker COMMAND [arg...]
  12. A self-sufficient runtime for linux containers.
  13. Commands:
  14. attach Attach to a running container
  15. commit Create a new image from a container's changes
  16. diff Inspect changes on a container's filesystem
  17. export Stream the contents of a container as a tar archive
  18. history Show the history of an image
  19. images List images
  20. import Create a new filesystem image from the contents of a tarball
  21. info Display system-wide information
  22. inspect Return low-level information on a container
  23. kill Kill a running container
  24. login Register or Login to the docker registry server
  25. logs Fetch the logs of a container
  26. port Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
  27. ps List containers
  28. pull Pull an image or a repository to the docker registry server
  29. push Push an image or a repository to the docker registry server
  30. restart Restart a running container
  31. rm Remove a container
  32. rmi Remove an image
  33. run Run a command in a new container
  34. start Start a stopped container
  35. stop Stop a running container
  36. tag Tag an image into a repository
  37. version Show the docker version information
  38. wait Block until a container stops, then print its exit code
  39. attach
  40. ~~~~~~
  41. ::
  42. Usage: docker attach [OPTIONS]
  43. Attach to a running container
  44. -e=true: Attach to stderr
  45. -i=false: Attach to stdin
  46. -o=true: Attach to stdout
  47. commit
  48. ~~~~~~
  49. ::
  50. Usage: docker commit [OPTIONS] CONTAINER [DEST]
  51. Create a new image from a container's changes
  52. -m="": Commit message
  53. diff
  54. ~~~~
  55. ::
  56. Usage: docker diff CONTAINER [OPTIONS]
  57. Inspect changes on a container's filesystem
  58. export
  59. ~~~~~~
  60. ::
  61. Usage: docker export CONTAINER
  62. Export the contents of a filesystem as a tar archive
  63. history
  64. ~~~~~~~
  65. ::
  66. Usage: docker history [OPTIONS] IMAGE
  67. Show the history of an image
  68. images
  69. ~~~~~~
  70. ::
  71. Usage: docker images [OPTIONS] [NAME]
  72. List images
  73. -a=false: show all images
  74. -q=false: only show numeric IDs
  75. import
  76. ~~~~~~
  77. ::
  78. Usage: docker import [OPTIONS] URL|- [REPOSITORY [TAG]]
  79. Create a new filesystem image from the contents of a tarball
  80. info
  81. ~~~~
  82. ::
  83. Usage: docker info
  84. Display system-wide information.
  85. inspect
  86. ~~~~~~~
  87. ::
  88. Usage: docker inspect [OPTIONS] CONTAINER
  89. Return low-level information on a container
  90. kill
  91. ~~~~
  92. ::
  93. Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...]
  94. Kill a running container
  95. login
  96. ~~~~~
  97. ::
  98. Usage: docker login
  99. Register or Login to the docker registry server
  100. logs
  101. ~~~~
  102. ::
  103. Usage: docker logs [OPTIONS] CONTAINER
  104. Fetch the logs of a container
  105. port
  106. ~~~~
  107. ::
  108. Usage: docker port [OPTIONS] CONTAINER PRIVATE_PORT
  109. Lookup the public-facing port which is NAT-ed to PRIVATE_PORT
  110. ps
  111. ~~
  112. ::
  113. Usage: docker ps [OPTIONS]
  114. List containers
  115. -a=false: Show all containers. Only running containers are shown by default.
  116. -notrunc=false: Don't truncate output
  117. -q=false: Only display numeric IDs
  118. pull
  119. ~~~~
  120. ::
  121. Usage: docker pull NAME
  122. Pull an image or a repository from the registry
  123. push
  124. ~~~~
  125. ::
  126. Usage: docker push NAME
  127. Push an image or a repository to the registry
  128. restart
  129. ~~~~~~~
  130. ::
  131. Usage: docker restart [OPTIONS] NAME
  132. Restart a running container
  133. rm
  134. ~~
  135. ::
  136. Usage: docker rm [OPTIONS] CONTAINER
  137. Remove a container
  138. rmi
  139. ~~~
  140. ::
  141. Usage: docker rmi [OPTIONS] IMAGE
  142. Remove an image
  143. -a=false: Use IMAGE as a path and remove ALL images in this path
  144. -r=false: Use IMAGE as a regular expression instead of an exact name
  145. run
  146. ~~~
  147. ::
  148. Usage: docker run [OPTIONS] IMAGE COMMAND [ARG...]
  149. Run a command in a new container
  150. -c="": Comment
  151. -i=false: Keep stdin open even if not attached
  152. -m=0: Memory limit (in bytes)
  153. -p=[]: Map a network port to the container
  154. -t=false: Allocate a pseudo-tty
  155. -h="": Container host name
  156. -u="": Username or UID
  157. start
  158. ~~~~~
  159. ::
  160. Usage: docker start [OPTIONS] NAME
  161. Start a stopped container
  162. stop
  163. ~~~~
  164. ::
  165. Usage: docker stop [OPTIONS] NAME
  166. Stop a running container
  167. tag
  168. ~~~
  169. ::
  170. Usage: docker tag [OPTIONS] IMAGE REPOSITORY [TAG]
  171. Tag an image into a repository
  172. -f=false: Force
  173. version
  174. ~~~~~~~
  175. ::
  176. Usage: docker version
  177. Show the docker version information
  178. wait
  179. ~~~~
  180. ::
  181. Usage: docker wait [OPTIONS] NAME
  182. Block until a container stops, then print its exit code.