试图搞懂在阿里云服务器上安装 docker 时打印的那些信息...

从现在开始要极其扎实地提升自己的计算机水平了。

最近在学习 docker,为了体验 docker 的使用,今天在阿里云上试用了一台云服务器。在操作云服务器的过程中,服务器界面会产生很多日志。这些日志我希望自己能够好好地看一看,而不是直接忽略掉。就当作是在读一本技术书了。再说了,这些日志做出肯定也是由人编写的,在操作机器的过程中这些日志会生成出来。

首先,通过阿里云提供的网页工具连接到服务器:

Last login: Wed Mar 16 16:07:14 2022 from 47.96.60.218

Welcome to Alibaba Cloud Elastic Compute Service !

说明这款 linux 被阿里里的人改造过,能懂这整个原理的人,真的太牛了。但也有可能是一个团队,有时候有一群人一起讨论和研究技术时,技术提升得会更加地快。

该两行日志会提示上次登录的日期和 ip 地址。(确定显示的是上次登录的时间吗?还是这次的登录时间?)

查看了一下当前服务器中是否安装了 docker,显然,没有:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# docker version
-bash: docker: command not found

# 后面输入的命令,root@iZbp1ewg7syr1dkin4vu9tZ ~是什么呢?

安装一下必要的工具:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# yum install -y yum-utils

以前也有浅玩过 linux,也见过 yum,但不知道 yum 到底是啥。那么上面这行指令到底是什么意思呢?翻译成大白话是什么意思?

运行上面的指令后,打印如下信息:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# yum install -y yum-utils
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                                                                                                                                                              | 3.6 kB  00:00:00     
epel                                                                                                                                                                                                              | 4.7 kB  00:00:00     
extras                                                                                                                                                                                                            | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                           | 2.9 kB  00:00:00     
(1/7): base/7/x86_64/group_gz                                                                                                                                                                                     | 153 kB  00:00:00     
(2/7): epel/x86_64/group_gz                                                                                                                                                                                       |  96 kB  00:00:00     
(3/7): extras/7/x86_64/primary_db                                                                                                                                                                                 | 246 kB  00:00:00     
(4/7): base/7/x86_64/primary_db                                                                                                                                                                                   | 6.1 MB  00:00:00     
(5/7): epel/x86_64/updateinfo                                                                                                                                                                                     | 1.1 MB  00:00:02     
(6/7): updates/7/x86_64/primary_db                                                                                                                                                                                |  14 MB  00:00:07     
(7/7): epel/x86_64/primary_db                                                                                                                                                                                     | 7.0 MB  00:00:18     
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-54.el7_8 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-54.el7_8.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-54.el7_8.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_9.6 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================================================================
 Package                                                     Arch                                                Version                                                      Repository                                            Size
=========================================================================================================================================================================================================================================
Installing:
 yum-utils                                                   noarch                                              1.1.31-54.el7_8                                              base                                                 122 k
Installing for dependencies:
 libxml2-python                                              x86_64                                              2.9.1-6.el7_9.6                                              updates                                              247 k
 python-chardet                                              noarch                                              2.2.1-3.el7                                                  base                                                 227 k
 python-kitchen                                              noarch                                              1.1.1-5.el7                                                  base                                                 267 k

Transaction Summary
=========================================================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 863 k
Installed size: 4.3 M
Downloading packages:
(1/4): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                                                                      | 267 kB  00:00:00     
(2/4): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                                                                       | 122 kB  00:00:00     
(3/4): libxml2-python-2.9.1-6.el7_9.6.x86_64.rpm                                                                                                                                                                  | 247 kB  00:00:00     
(4/4): python-chardet-2.2.1-3.el7.noarch.rpm                                                                                                                                                                      | 227 kB  00:00:00     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                    1.4 MB/s | 863 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                                                     1/4 
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                                                     2/4 
  Installing : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                                 3/4 
  Installing : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                      4/4 
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                                                     1/4 
  Verifying  : yum-utils-1.1.31-54.el7_8.noarch                                                                                                                                                                                      2/4 
  Verifying  : libxml2-python-2.9.1-6.el7_9.6.x86_64                                                                                                                                                                                 3/4 
  Verifying  : python-chardet-2.2.1-3.el7.noarch                                                                                                                                                                                     4/4 

Installed:
  yum-utils.noarch 0:1.1.31-54.el7_8                                                                                                                                                                                                     

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_9.6                                         python-chardet.noarch 0:2.2.1-3.el7                                         python-kitchen.noarch 0:1.1.1-5.el7                                        

Complete!

呵呵,看不太懂。只知道还安装了 yum-utils 的一些依赖。

接下去设置镜像仓库(也不知道镜像仓库是个什么玩意儿):

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo

只是听说这么设置的话,在这台服务器中安装 docker ,安装速度会更快一些。

接下去安装 docker:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# yum install docker-ce docker-ce-cli containerd.io
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
docker-ce-stable                                                                                                                                                                                                  | 3.5 kB  00:00:00     
(1/2): docker-ce-stable/7/x86_64/updateinfo                                                                                                                                                                       |   55 B  00:00:00     
(2/2): docker-ce-stable/7/x86_64/primary_db                                                                                                                                                                       |  73 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package containerd.io.x86_64 0:1.5.10-3.1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: containerd.io-1.5.10-3.1.el7.x86_64
---> Package docker-ce.x86_64 3:20.10.13-3.el7 will be installed
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-20.10.13-3.el7.x86_64
--> Processing Dependency: libcgroup for package: 3:docker-ce-20.10.13-3.el7.x86_64
---> Package docker-ce-cli.x86_64 1:20.10.13-3.el7 will be installed
--> Processing Dependency: docker-scan-plugin(x86-64) for package: 1:docker-ce-cli-20.10.13-3.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
--> Processing Dependency: policycoreutils-python for package: 2:container-selinux-2.119.2-1.911c772.el7_8.noarch
---> Package docker-ce-rootless-extras.x86_64 0:20.10.13-3.el7 will be installed
--> Processing Dependency: fuse-overlayfs >= 0.7 for package: docker-ce-rootless-extras-20.10.13-3.el7.x86_64
--> Processing Dependency: slirp4netns >= 0.4 for package: docker-ce-rootless-extras-20.10.13-3.el7.x86_64
---> Package docker-scan-plugin.x86_64 0:0.17.0-3.el7 will be installed
---> Package libcgroup.x86_64 0:0.41-21.el7 will be installed
--> Running transaction check
---> Package fuse-overlayfs.x86_64 0:0.7.2-6.el7_8 will be installed
--> Processing Dependency: libfuse3.so.3(FUSE_3.2)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3(FUSE_3.0)(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
--> Processing Dependency: libfuse3.so.3()(64bit) for package: fuse-overlayfs-0.7.2-6.el7_8.x86_64
---> Package policycoreutils-python.x86_64 0:2.5-34.el7 will be installed
--> Processing Dependency: setools-libs >= 3.3.8-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libsemanage-python >= 2.5-14 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: audit-libs-python >= 2.1.3-4 for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: python-IPy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.4)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1(VERS_1.2)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4(VERS_4.0)(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: checkpolicy for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libqpol.so.1()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
--> Processing Dependency: libapol.so.4()(64bit) for package: policycoreutils-python-2.5-34.el7.x86_64
---> Package slirp4netns.x86_64 0:0.4.3-4.el7_8 will be installed
--> Running transaction check
---> Package audit-libs-python.x86_64 0:2.8.5-4.el7 will be installed
---> Package checkpolicy.x86_64 0:2.5-8.el7 will be installed
---> Package fuse3-libs.x86_64 0:3.6.1-4.el7 will be installed
---> Package libsemanage-python.x86_64 0:2.5-14.el7 will be installed
---> Package python-IPy.noarch 0:0.75-6.el7 will be installed
---> Package setools-libs.x86_64 0:3.3.8-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=========================================================================================================================================================================================================================================
 Package                                                        Arch                                        Version                                                          Repository                                             Size
=========================================================================================================================================================================================================================================
Installing:
 containerd.io                                                  x86_64                                      1.5.10-3.1.el7                                                   docker-ce-stable                                       30 M
 docker-ce                                                      x86_64                                      3:20.10.13-3.el7                                                 docker-ce-stable                                       22 M
 docker-ce-cli                                                  x86_64                                      1:20.10.13-3.el7                                                 docker-ce-stable                                       30 M
Installing for dependencies:
 audit-libs-python                                              x86_64                                      2.8.5-4.el7                                                      base                                                   76 k
 checkpolicy                                                    x86_64                                      2.5-8.el7                                                        base                                                  295 k
 container-selinux                                              noarch                                      2:2.119.2-1.911c772.el7_8                                        extras                                                 40 k
 docker-ce-rootless-extras                                      x86_64                                      20.10.13-3.el7                                                   docker-ce-stable                                      8.1 M
 docker-scan-plugin                                             x86_64                                      0.17.0-3.el7                                                     docker-ce-stable                                      3.7 M
 fuse-overlayfs                                                 x86_64                                      0.7.2-6.el7_8                                                    extras                                                 54 k
 fuse3-libs                                                     x86_64                                      3.6.1-4.el7                                                      extras                                                 82 k
 libcgroup                                                      x86_64                                      0.41-21.el7                                                      base                                                   66 k
 libsemanage-python                                             x86_64                                      2.5-14.el7                                                       base                                                  113 k
 policycoreutils-python                                         x86_64                                      2.5-34.el7                                                       base                                                  457 k
 python-IPy                                                     noarch                                      0.75-6.el7                                                       base                                                   32 k
 setools-libs                                                   x86_64                                      3.3.8-4.el7                                                      base                                                  620 k
 slirp4netns                                                    x86_64                                      0.4.3-4.el7_8                                                    extras                                                 81 k

Transaction Summary
=========================================================================================================================================================================================================================================
Install  3 Packages (+13 Dependent packages)

Total download size: 96 M
Installed size: 387 M
Is this ok [y/d/N]: y
Downloading packages:
(1/16): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                                                                      |  40 kB  00:00:00     
(2/16): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                                                                                                                  |  76 kB  00:00:00     
(3/16): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                                                                                          | 295 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-20.10.13-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY                                                 ] 764 kB/s |  45 MB  00:01:08 ETA 
Public key for docker-ce-20.10.13-3.el7.x86_64.rpm is not installed
(4/16): docker-ce-20.10.13-3.el7.x86_64.rpm                                                                                                                                                                       |  22 MB  00:00:58     
(5/16): containerd.io-1.5.10-3.1.el7.x86_64.rpm                                                                                                                                                                   |  30 MB  00:01:18     
(6/16): docker-ce-rootless-extras-20.10.13-3.el7.x86_64.rpm                                                                                                                                                       | 8.1 MB  00:00:20     
(7/16): fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm                                                                                                                                                                   |  54 kB  00:00:00     
(8/16): libsemanage-python-2.5-14.el7.x86_64.rpm                                                                                                                                                                  | 113 kB  00:00:00     
(9/16): libcgroup-0.41-21.el7.x86_64.rpm                                                                                                                                                                          |  66 kB  00:00:00     
(10/16): python-IPy-0.75-6.el7.noarch.rpm                                                                                                                                                                         |  32 kB  00:00:00     
(11/16): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                                                                                                             | 457 kB  00:00:00     
(12/16): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                                                                        |  82 kB  00:00:00     
(13/16): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                                                                     |  81 kB  00:00:00     
(14/16): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                                                                      | 620 kB  00:00:00     
(15/16): docker-scan-plugin-0.17.0-3.el7.x86_64.rpm                                                                                                                                                               | 3.7 MB  00:00:09     
(16/16): docker-ce-cli-20.10.13-3.el7.x86_64.rpm                                                                                                                                                                  |  30 MB  00:01:17     
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                    724 kB/s |  96 MB  00:02:16     
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) "
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : docker-scan-plugin-0.17.0-3.el7.x86_64                                                                                                                                                                               1/16 
  Installing : 1:docker-ce-cli-20.10.13-3.el7.x86_64                                                                                                                                                                                2/16 
  Installing : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                                         3/16 
  Installing : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                      4/16 
  Installing : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                                                 5/16 
  Installing : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                                                     6/16 
  Installing : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                                         7/16 
  Installing : python-IPy-0.75-6.el7.noarch                                                                                                                                                                                         8/16 
  Installing : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                                        9/16 
  Installing : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                                                 10/16 
  Installing : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                11/16 
  Installing : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                                            12/16 
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                                                  13/16 
setsebool:  SELinux is disabled.
  Installing : containerd.io-1.5.10-3.1.el7.x86_64                                                                                                                                                                                 14/16 
  Installing : docker-ce-rootless-extras-20.10.13-3.el7.x86_64                                                                                                                                                                     15/16 
  Installing : 3:docker-ce-20.10.13-3.el7.x86_64                                                                                                                                                                                   16/16 
  Verifying  : libsemanage-python-2.5-14.el7.x86_64                                                                                                                                                                                 1/16 
  Verifying  : fuse3-libs-3.6.1-4.el7.x86_64                                                                                                                                                                                        2/16 
  Verifying  : containerd.io-1.5.10-3.1.el7.x86_64                                                                                                                                                                                  3/16 
  Verifying  : 1:docker-ce-cli-20.10.13-3.el7.x86_64                                                                                                                                                                                4/16 
  Verifying  : fuse-overlayfs-0.7.2-6.el7_8.x86_64                                                                                                                                                                                  5/16 
  Verifying  : 3:docker-ce-20.10.13-3.el7.x86_64                                                                                                                                                                                    6/16 
  Verifying  : docker-ce-rootless-extras-20.10.13-3.el7.x86_64                                                                                                                                                                      7/16 
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                                                                                                   8/16 
  Verifying  : python-IPy-0.75-6.el7.noarch                                                                                                                                                                                         9/16 
  Verifying  : checkpolicy-2.5-8.el7.x86_64                                                                                                                                                                                        10/16 
  Verifying  : slirp4netns-0.4.3-4.el7_8.x86_64                                                                                                                                                                                    11/16 
  Verifying  : policycoreutils-python-2.5-34.el7.x86_64                                                                                                                                                                            12/16 
  Verifying  : docker-scan-plugin-0.17.0-3.el7.x86_64                                                                                                                                                                              13/16 
  Verifying  : audit-libs-python-2.8.5-4.el7.x86_64                                                                                                                                                                                14/16 
  Verifying  : setools-libs-3.3.8-4.el7.x86_64                                                                                                                                                                                     15/16 
  Verifying  : libcgroup-0.41-21.el7.x86_64                                                                                                                                                                                        16/16 

Installed:
  containerd.io.x86_64 0:1.5.10-3.1.el7                                         docker-ce.x86_64 3:20.10.13-3.el7                                         docker-ce-cli.x86_64 1:20.10.13-3.el7                                        

Dependency Installed:
  audit-libs-python.x86_64 0:2.8.5-4.el7    checkpolicy.x86_64 0:2.5-8.el7       container-selinux.noarch 2:2.119.2-1.911c772.el7_8    docker-ce-rootless-extras.x86_64 0:20.10.13-3.el7    docker-scan-plugin.x86_64 0:0.17.0-3.el7     
  fuse-overlayfs.x86_64 0:0.7.2-6.el7_8     fuse3-libs.x86_64 0:3.6.1-4.el7      libcgroup.x86_64 0:0.41-21.el7                        libsemanage-python.x86_64 0:2.5-14.el7               policycoreutils-python.x86_64 0:2.5-34.el7   
  python-IPy.noarch 0:0.75-6.el7            setools-libs.x86_64 0:3.3.8-4.el7    slirp4netns.x86_64 0:0.4.3-4.el7_8                   

Complete!

这些信息其实和刚刚安装 yum-utils 时打印的信息有些类似。

检查一下 docker 是否安装成功:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# docker version
Client: Docker Engine - Community
 Version:           20.10.13
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 10 14:09:51 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

可以看到 docker 的一些基础信息。


2022-03-17 更新 | 今天继续学习 docker

下面的指令是设置 docker 开机自启,运行命令后,打印的信息如下:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.

看不太懂,对于 linux 的认知可以说是零基础级别。

运行 docker info,我觉得这部分需要打印出来好好看一下:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Docker Buildx (Docker Inc., v0.8.0-docker)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 3
  Running: 0
  Paused: 0
  Stopped: 3
 Images: 2
 Server Version: 20.10.13
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc
 runc version: v1.0.3-0-gf46b6ba
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 3.10.0-1160.53.1.el7.x86_64
 Operating System: CentOS Linux 7 (Core)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.795GiB
 Name: iZbp1ewg7syr1dkin4vu9tZ
 ID: 6JWF:VONU:S6JJ:C732:NX7X:VWVL:QU3U:J576:K462:DSON:B6PJ:URKZ
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://wem9x4gz.mirror.aliyuncs.com/
 Live Restore Enabled: false

docker [command] --help,以 docker run --help 为例,这部分也需要打印出来好好看一下:

[root@iZbp1ewg7syr1dkin4vu9tZ ~]# docker run --help

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

Options:
      --add-host list                  Add a custom host-to-IP mapping (host:ip)
  -a, --attach list                    Attach to STDIN, STDOUT or STDERR
      --blkio-weight uint16            Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
      --blkio-weight-device list       Block IO weight (relative device weight) (default [])
      --cap-add list                   Add Linux capabilities
      --cap-drop list                  Drop Linux capabilities
      --cgroup-parent string           Optional parent cgroup for the container
      --cgroupns string                Cgroup namespace to use (host|private)
                                       'host':    Run the container in the Docker host's cgroup namespace
                                       'private': Run the container in its own private cgroup namespace
                                       '':        Use the cgroup namespace as configured by the
                                                  default-cgroupns-mode option on the daemon (default)
      --cidfile string                 Write the container ID to the file
      --cpu-period int                 Limit CPU CFS (Completely Fair Scheduler) period
      --cpu-quota int                  Limit CPU CFS (Completely Fair Scheduler) quota
      --cpu-rt-period int              Limit CPU real-time period in microseconds
      --cpu-rt-runtime int             Limit CPU real-time runtime in microseconds
  -c, --cpu-shares int                 CPU shares (relative weight)
      --cpus decimal                   Number of CPUs
      --cpuset-cpus string             CPUs in which to allow execution (0-3, 0,1)
      --cpuset-mems string             MEMs in which to allow execution (0-3, 0,1)
  -d, --detach                         Run container in background and print container ID
      --detach-keys string             Override the key sequence for detaching a container
      --device list                    Add a host device to the container
      --device-cgroup-rule list        Add a rule to the cgroup allowed devices list
      --device-read-bps list           Limit read rate (bytes per second) from a device (default [])
      --device-read-iops list          Limit read rate (IO per second) from a device (default [])
      --device-write-bps list          Limit write rate (bytes per second) to a device (default [])
      --device-write-iops list         Limit write rate (IO per second) to a device (default [])
      --disable-content-trust          Skip image verification (default true)
      --dns list                       Set custom DNS servers
      --dns-option list                Set DNS options
      --dns-search list                Set custom DNS search domains
      --domainname string              Container NIS domain name
      --entrypoint string              Overwrite the default ENTRYPOINT of the image
  -e, --env list                       Set environment variables
      --env-file list                  Read in a file of environment variables
      --expose list                    Expose a port or a range of ports
      --gpus gpu-request               GPU devices to add to the container ('all' to pass all GPUs)
      --group-add list                 Add additional groups to join
      --health-cmd string              Command to run to check health
      --health-interval duration       Time between running the check (ms|s|m|h) (default 0s)
      --health-retries int             Consecutive failures needed to report unhealthy
      --health-start-period duration   Start period for the container to initialize before starting health-retries countdown (ms|s|m|h) (default 0s)
      --health-timeout duration        Maximum time to allow one check to run (ms|s|m|h) (default 0s)
      --help                           Print usage
  -h, --hostname string                Container host name
      --init                           Run an init inside the container that forwards signals and reaps processes
  -i, --interactive                    Keep STDIN open even if not attached
      --ip string                      IPv4 address (e.g., 172.30.100.104)
      --ip6 string                     IPv6 address (e.g., 2001:db8::33)
      --ipc string                     IPC mode to use
      --isolation string               Container isolation technology
      --kernel-memory bytes            Kernel memory limit
  -l, --label list                     Set meta data on a container
      --label-file list                Read in a line delimited file of labels
      --link list                      Add link to another container
      --link-local-ip list             Container IPv4/IPv6 link-local addresses
      --log-driver string              Logging driver for the container
      --log-opt list                   Log driver options
      --mac-address string             Container MAC address (e.g., 92:d0:c6:0a:29:33)
  -m, --memory bytes                   Memory limit
      --memory-reservation bytes       Memory soft limit
      --memory-swap bytes              Swap limit equal to memory plus swap: '-1' to enable unlimited swap
      --memory-swappiness int          Tune container memory swappiness (0 to 100) (default -1)
      --mount mount                    Attach a filesystem mount to the container
      --name string                    Assign a name to the container
      --network network                Connect a container to a network
      --network-alias list             Add network-scoped alias for the container
      --no-healthcheck                 Disable any container-specified HEALTHCHECK
      --oom-kill-disable               Disable OOM Killer
      --oom-score-adj int              Tune host's OOM preferences (-1000 to 1000)
      --pid string                     PID namespace to use
      --pids-limit int                 Tune container pids limit (set -1 for unlimited)
      --platform string                Set platform if server is multi-platform capable
      --privileged                     Give extended privileges to this container
  -p, --publish list                   Publish a container's port(s) to the host
  -P, --publish-all                    Publish all exposed ports to random ports
      --pull string                    Pull image before running ("always"|"missing"|"never") (default "missing")
      --read-only                      Mount the container's root filesystem as read only
      --restart string                 Restart policy to apply when a container exits (default "no")
      --rm                             Automatically remove the container when it exits
      --runtime string                 Runtime to use for this container
      --security-opt list              Security Options
      --shm-size bytes                 Size of /dev/shm
      --sig-proxy                      Proxy received signals to the process (default true)
      --stop-signal string             Signal to stop a container (default "SIGTERM")
      --stop-timeout int               Timeout (in seconds) to stop a container
      --storage-opt list               Storage driver options for the container
      --sysctl map                     Sysctl options (default map[])
      --tmpfs list                     Mount a tmpfs directory
  -t, --tty                            Allocate a pseudo-TTY
      --ulimit ulimit                  Ulimit options (default [])
  -u, --user string                    Username or UID (format: [:])
      --userns string                  User namespace to use
      --uts string                     UTS namespace to use
  -v, --volume list                    Bind mount a volume
      --volume-driver string           Optional volume driver for the container
      --volumes-from list              Mount volumes from the specified container(s)
  -w, --workdir string                 Working directory inside the container

你可能感兴趣的:(docker,docker,阿里云,运维)