IoTEdge ecs(x86_64) centos7安装docker-ce【我的IoT端边云体验】

举报
千江有水千江月 发表于 2022/10/31 19:38:15 2022/10/31
【摘要】 iot边缘节点在文档如何将一台机器注册成边缘节点中提到要安装docker。我就把自己的安装过程较为完整的展示出来,希望能给后来的同学提供一些参考资料。  过程展示 购买与启动ecs注:购买的ecs要符合硬件规格我比较喜欢用华为云平台自带的cloudshell。 查看OS信息[root@ecs-5145 ~]# uname -r3.10.0-1160.53.1.el7.x86_64[root...

iot边缘节点

在文档如何将一台机器注册成边缘节点中提到要安装docker。我就把自己的安装过程较为完整的展示出来,希望能给后来的同学提供一些参考资料。

过程展示

购买与启动ecs

ecs-c-dockerce-1.png

ecs-c-dockerce-2.png

ecs-c-dockerce-3.png

ecs-c-dockerce-4.png

ecs-c-dockerce-5.png

ecs-c-dockerce-6.png

ecs-c-dockerce-7.png

ecs-c-dockerce-8.png

ecs-c-dockerce-9.png

  • 我比较喜欢用华为云平台自带的cloudshell。

ecs-c-dockerce-10.png

查看OS信息

[root@ecs-5145 ~]# uname -r
3.10.0-1160.53.1.el7.x86_64

[root@ecs-5145 ~]# uname -a
Linux ecs-5145 3.10.0-1160.53.1.el7.x86_64 #1 SMP Fri Jan 14 13:59:45 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[root@ecs-5145 ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

yum-utils

[root@ecs-5145 ~]# yum install 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/updateinfo                                                                                                                                | 1.0 MB  00:00:00     
(3/7): epel/x86_64/group_gz                                                                                                                                  |  98 kB  00:00:00     
(4/7): epel/x86_64/primary_db                                                                                                                                | 7.0 MB  00:00:00     
(5/7): base/7/x86_64/primary_db                                                                                                                              | 6.1 MB  00:00:00     
(6/7): extras/7/x86_64/primary_db                                                                                                                            | 249 kB  00:00:00     
(7/7): updates/7/x86_64/primary_db                                                                                                                           |  17 MB  00:00:00     
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
--> Running transaction check
---> 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:
 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 (+2 Dependent packages)

Total download size: 616 k
Installed size: 2.8 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): python-chardet-2.2.1-3.el7.noarch.rpm                                                                                                                 | 227 kB  00:00:00     
(2/3): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                 | 267 kB  00:00:00     
(3/3): yum-utils-1.1.31-54.el7_8.noarch.rpm                                                                                                                  | 122 kB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                               2.7 MB/s | 616 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.

......此处因篇幅限制而做删减......

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

Dependency Installed:
  python-chardet.noarch 0:2.2.1-3.el7                                                      python-kitchen.noarch 0:1.1.1-5.el7                                                     

Complete!
[root@ecs-5145 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror
adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://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
[root@ecs-5145 ~]# yum makecache
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
base                                                                                                                                                         | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                             | 3.5 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/13): base/7/x86_64/other_db                                                                                                                               | 2.6 MB  00:00:00     
(2/13): docker-ce-stable/7/x86_64/updateinfo                                                                                                                 |   55 B  00:00:00     
(3/13): docker-ce-stable/7/x86_64/filelists_db                                                                                                               |  36 kB  00:00:00     
(4/13): base/7/x86_64/filelists_db                                                                                                                           | 7.2 MB  00:00:00     
(5/13): epel/x86_64/filelists_db                                                                                                                             |  12 MB  00:00:00     
(6/13): docker-ce-stable/7/x86_64/primary_db                                                                                                                 |  87 kB  00:00:00     
(7/13): docker-ce-stable/7/x86_64/other_db                                                                                                                   | 127 kB  00:00:00     
(8/13): epel/x86_64/prestodelta                                                                                                                              | 2.8 kB  00:00:00     
(9/13): epel/x86_64/other_db                                                                                                                                 | 3.4 MB  00:00:00     
(10/13): updates/7/x86_64/filelists_db                                                                                                                       | 9.6 MB  00:00:00     
(11/13): extras/7/x86_64/other_db                                                                                                                            | 149 kB  00:00:00     
(12/13): extras/7/x86_64/filelists_db                                                                                                                        | 276 kB  00:00:01     
(13/13): updates/7/x86_64/other_db                                                                                                                           | 1.2 MB  00:00:02     
Metadata Cache Created
[root@ecs-5145 ~]# yum list docker*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
docker.x86_64                                                                     2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-ce.x86_64                                                                  3:20.10.21-3.el7                                                                  docker-ce-stable
docker-ce-cli.x86_64                                                              1:20.10.21-3.el7                                                                  docker-ce-stable
docker-ce-rootless-extras.x86_64                                                  20.10.21-3.el7                                                                    docker-ce-stable
docker-ce-selinux.noarch                                                          17.03.3.ce-1.el7                                                                  docker-ce-stable
docker-client.x86_64                                                              2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-client-latest.x86_64                                                       1.13.1-58.git87f2fab.el7.centos                                                   extras          
docker-common.x86_64                                                              2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-compose.noarch                                                             1.18.0-4.el7                                                                      epel            
docker-compose-plugin.x86_64                                                      2.12.2-3.el7                                                                      docker-ce-stable
docker-distribution.x86_64                                                        2.6.2-2.git48294d9.el7                                                            extras          
docker-latest.x86_64                                                              1.13.1-58.git87f2fab.el7.centos                                                   extras          
docker-latest-logrotate.x86_64                                                    1.13.1-58.git87f2fab.el7.centos                                                   extras          
docker-latest-v1.10-migrator.x86_64                                               1.13.1-58.git87f2fab.el7.centos                                                   extras          
docker-logrotate.x86_64                                                           2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-lvm-plugin.x86_64                                                          2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-novolume-plugin.x86_64                                                     2:1.13.1-209.git7d71120.el7.centos                                                extras          
docker-registry.x86_64                                                            0.9.1-7.el7                                                                       extras          
docker-scan-plugin.x86_64                                                         0.21.0-3.el7                                                                      docker-ce-stable
docker-v1.10-migrator.x86_64                                                      2:1.13.1-209.git7d71120.el7.centos                                                extras  

docker-ce

  • 安装的docker-ce版本要符合iot edge的最低要求。如果版本出问题的话,那么在后续 安装 命令运行时,会提示docker版本不符合要求的。
[root@ecs-5145 ~]# yum install docker-ce
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
......此处因篇幅限制而做删减......
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================================================
 Package                                           Arch                           Version                                            Repository                                Size
====================================================================================================================================================================================
Installing:
 docker-ce                                         x86_64                         3:20.10.21-3.el7                                   docker-ce-stable                          22 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
 containerd.io                                     x86_64                         1.6.9-3.1.el7                                      docker-ce-stable                          33 M
 docker-ce-cli                                     x86_64                         1:20.10.21-3.el7                                   docker-ce-stable                          30 M
 docker-ce-rootless-extras                         x86_64                         20.10.21-3.el7                                     docker-ce-stable                         8.5 M
 docker-scan-plugin                                x86_64                         0.21.0-3.el7                                       docker-ce-stable                         3.8 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  1 Package (+15 Dependent packages)

Total download size: 98 M
Installed size: 361 M
Is this ok [y/d/N]: y
Downloading packages:
(1/16): audit-libs-python-2.8.5-4.el7.x86_64.rpm                                                                                                             |  76 kB  00:00:00     
(2/16): checkpolicy-2.5-8.el7.x86_64.rpm                                                                                                                     | 295 kB  00:00:00     
(3/16): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                                                 |  40 kB  00:00:00     
warning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-ce-20.10.21-3.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY4 MB/s |  42 MB  00:00:41 ETA 
Public key for docker-ce-20.10.21-3.el7.x86_64.rpm is not installed
(4/16): docker-ce-20.10.21-3.el7.x86_64.rpm                                                                                                                  |  22 MB  00:00:33     
(5/16): containerd.io-1.6.9-3.1.el7.x86_64.rpm                                                                                                               |  33 MB  00:00:51     
(6/16): docker-ce-rootless-extras-20.10.21-3.el7.x86_64.rpm                                                                                                  | 8.5 MB  00:00:12     
(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): policycoreutils-python-2.5-34.el7.x86_64.rpm                                                                                                         | 457 kB  00:00:00     
(10/16): python-IPy-0.75-6.el7.noarch.rpm                                                                                                                    |  32 kB  00:00:00     
(11/16): setools-libs-3.3.8-4.el7.x86_64.rpm                                                                                                                 | 620 kB  00:00:00     
(12/16): slirp4netns-0.4.3-4.el7_8.x86_64.rpm                                                                                                                |  81 kB  00:00:00     
(13/16): fuse3-libs-3.6.1-4.el7.x86_64.rpm                                                                                                                   |  82 kB  00:00:00     
(14/16): libcgroup-0.41-21.el7.x86_64.rpm                                                                                                                    |  66 kB  00:00:00     
(15/16): docker-scan-plugin-0.21.0-3.el7.x86_64.rpm                                                                                                          | 3.8 MB  00:00:06     
(16/16): docker-ce-cli-20.10.21-3.el7.x86_64.rpm                                                                                                             |  30 MB  00:00:43     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                               1.3 MB/s |  98 MB  00:01:17     
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 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 : libcgroup-0.41-21.el7.x86_64                     

......此处因篇幅限制而做删减......
 
Installed:
  docker-ce.x86_64 3:20.10.21-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                
  containerd.io.x86_64 0:1.6.9-3.1.el7                     docker-ce-cli.x86_64 1:20.10.21-3.el7                  docker-ce-rootless-extras.x86_64 0:20.10.21-3.el7                 
  docker-scan-plugin.x86_64 0:0.21.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!

查看版本与启动docker

[root@ecs-5145 ~]# docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:04:24 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?
[root@ecs-5145 ~]# systemctl start docker
[root@ecs-5145 ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2022-10-31 18:40:25 CST; 4s ago
     Docs: https://docs.docker.com
 Main PID: 8363 (dockerd)
    Tasks: 8
   Memory: 28.3M
   CGroup: /system.slice/docker.service
           └─8363 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.456803179+08:00" level=info msg="scheme \"unix\" not registered, fallback to default scheme" module=grpc
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.456817549+08:00" level=info msg="ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/...module=grpc
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.456826979+08:00" level=info msg="ClientConn switching balancer to \"pick_first\"" module=grpc
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.476359293+08:00" level=info msg="Loading containers: start."
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.565913079+08:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/...IP address"
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.598172212+08:00" level=info msg="Loading containers: done."
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.612673440+08:00" level=info msg="Docker daemon" commit=3056208 graphdriver(s)=overlay2 version=20.10.21
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.612741445+08:00" level=info msg="Daemon has completed initialization"
Oct 31 18:40:25 ecs-5145 systemd[1]: Started Docker Application Container Engine.
Oct 31 18:40:25 ecs-5145 dockerd[8363]: time="2022-10-31T18:40:25.630688264+08:00" level=info msg="API listen on /var/run/docker.sock"
Hint: Some lines were ellipsized, use -l to show in full.
[root@ecs-5145 ~]# docker version
Client: Docker Engine - Community
 Version:           20.10.21
 API version:       1.41
 Go version:        go1.18.7
 Git commit:        baeda1f
 Built:             Tue Oct 25 18:04:24 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.21
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.7
  Git commit:       3056208
  Built:            Tue Oct 25 18:02:38 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.9
  GitCommit:        1c90a442489720eec95342e1789ee8a5e1b9536f
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

参考资料

附加

【我的IoT端边云体验】有奖征文火热进行中:https://bbs.huaweicloud.com/blogs/378687

此外,在(https://bbs.huaweicloud.com/activity/suggestion.html)提出您的宝贵建议,标题以【云驻计划-定向征文】开头,还有机会赢取额外奖励。

【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。