首先我们需要通过docker -h 了解在计算机上安装了docker 后能够使用常用命令的类型,这样是最全的,了解了基本的命令构成然后根据使用的场景会形成一些特定的组合命令或者结合shell脚本语言进行一些骚操作.
**

  1. Usage: docker [OPTIONS] COMMAND
  2. A self-sufficient runtime for containers
  3. Options:
  4. --config string Location of client config files (default "/home/doct/.docker")
  5. -D, --debug Enable debug mode
  6. -H, --host list Daemon socket(s) to connect to
  7. -l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
  8. --tls Use TLS; implied by --tlsverify
  9. --tlscacert string Trust certs signed only by this CA (default "/home/doct/.docker/ca.pem")
  10. --tlscert string Path to TLS certificate file (default "/home/doct/.docker/cert.pem")
  11. --tlskey string Path to TLS key file (default "/home/doct/.docker/key.pem")
  12. --tlsverify Use TLS and verify the remote
  13. -v, --version Print version information and quit
  14. Management Commands:
  15. builder Manage builds
  16. config Manage Docker configs
  17. container Manage containers
  18. engine Manage the docker engine
  19. image Manage images
  20. network Manage networks
  21. node Manage Swarm nodes
  22. plugin Manage plugins
  23. secret Manage Docker secrets
  24. service Manage services
  25. stack Manage Docker stacks
  26. swarm Manage Swarm
  27. system Manage Docker
  28. trust Manage trust on Docker images
  29. volume Manage volumes
  30. Commands:
  31. attach Attach local standard input, output, and error streams to a running container
  32. build Build an image from a Dockerfile
  33. commit Create a new image from a container's changes
  34. cp Copy files/folders between a container and the local filesystem
  35. create Create a new container
  36. diff Inspect changes to files or directories on a container's filesystem
  37. events Get real time events from the server
  38. exec Run a command in a running container
  39. export Export a container's filesystem as a tar archive
  40. history Show the history of an image
  41. images List images
  42. import Import the contents from a tarball to create a filesystem image
  43. info Display system-wide information
  44. inspect Return low-level information on Docker objects
  45. kill Kill one or more running containers
  46. load Load an image from a tar archive or STDIN
  47. login Log in to a Docker registry
  48. logout Log out from a Docker registry
  49. logs Fetch the logs of a container
  50. pause Pause all processes within one or more containers
  51. port List port mappings or a specific mapping for the container
  52. ps List containers
  53. pull Pull an image or a repository from a registry
  54. push Push an image or a repository to a registry
  55. rename Rename a container
  56. restart Restart one or more containers
  57. rm Remove one or more containers
  58. rmi Remove one or more images
  59. run Run a command in a new container
  60. save Save one or more images to a tar archive (streamed to STDOUT by default)
  61. search Search the Docker Hub for images
  62. start Start one or more stopped containers
  63. stats Display a live stream of container(s) resource usage statistics
  64. stop Stop one or more running containers
  65. tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
  66. top Display the running processes of a container
  67. unpause Unpause all processes within one or more containers
  68. update Update configuration of one or more containers
  69. version Show the Docker version information
  70. wait Block until one or more containers stop, then print their exit codes

docker 本身的命令

1. docker version (查看docker 的版本)

  1. Client:
  2. Version: 18.06.1-ce
  3. API version: 1.38
  4. Go version: go1.10.3
  5. Git commit: e68fc7a
  6. Built: Tue Aug 21 17:23:03 2018
  7. OS/Arch: linux/amd64
  8. Experimental: false
  9. Server:
  10. Engine:
  11. Version: 18.06.1-ce
  12. API version: 1.38 (minimum version 1.12)
  13. Go version: go1.10.3
  14. Git commit: e68fc7a
  15. Built: Tue Aug 21 17:25:29 2018
  16. OS/Arch: linux/amd64
  17. Experimental: false

需要关注的是API版本,因为有有些功能和参数规定只有在高版本的API上可以使用

docker system 命令

主要用于管理docker

  1. Commands:
  2. df Show docker disk usage
  3. events Get real time events from the server
  4. info Display system-wide information
  5. prune Remove unused data

docker swarm相关命令

查看docker swarm版本