docker ing - 图1
容器化部署应用,快速发布服务,方便集群部署管理;

devops、k8s都少不了 docker。

windows 安装 docker

需要 wsl、ubuntu 20.04LTS、docker desktop
先安装 docker desktop ,根据提示在安装缺少的。

参考:https://docs.microsoft.com/en-us/windows/wsl/install-win10#manual-installation-steps 选择手动安装

注意:

安装过程的报错勿慌,重启,再次安装即可(比如 wsl msi更新包的安装);
Ubuntu 的 root 默认不可使用,要使用如下:

  1. ubunturoot用户默认是禁止的,需要手动打开才行
  2. 事实上ubuntu下的所有操作都用不到root用户,由于sudo的合理使用,避免了root用户下误操作而产生的毁灭性问题
  3. root账号启用方法(其实我个人认为这没有多大必要):
  4. 执行下面的操作:
  5. 1.先解除root锁定,为root用户设置密码
  6. 打开终端输入:sudo passwd
  7. Password: <--- 输入你当前用户的密码
  8. Enter new UNIX password: <--- 新的Root用户密码
  9. Retype new UNIX password: <--- 重复新的Root用户密码
  10. passwd:已成功更新密码
  11. 注销当前用户,以root登陆
  12. 如果要再次禁用 root 帐号,那么可以执行 sudo passwd -l root

命令行

  1. xiaohui@DESKTOP-44T4DSR:~$ sudo passwd
  2. [sudo] password for xiaohui:
  3. New password:
  4. Retype new password:
  5. Sorry, passwords do not match.
  6. passwd: Authentication token manipulation error
  7. passwd: password unchanged
  8. xiaohui@DESKTOP-44T4DSR:~$ sudo passwd
  9. New password:
  10. Retype new password:
  11. passwd: password updated successfully
  12. xiaohui@DESKTOP-44T4DSR:~$ su root
  13. Password:
  14. root@DESKTOP-44T4DSR:/home/xiaohui#

本次安装的用户密码:xiaohui/xiaohui,root/xiaohui

docker 命令帮助

docker

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

docker COMMAND —help

docker rm —help
docker port —help