yum方式安装Docker
1.查看Centos版本命令
[root@suzhongde suzhongde]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
这里CentOS Linux release
7.9
.2009 (Core)的版本必须大于3.0
2.需要确保当前安装的CentOS系统可以上网
[root@suzhongde suzhongde]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.109) 56(84) bytes of data.
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=1 ttl=54 time=9.02 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=2 ttl=54 time=9.83 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=3 ttl=54 time=9.60 ms
64 bytes from 163.177.151.109 (163.177.151.109): icmp_seq=4 ttl=54 time=9.77 ms
3.使用yum安装gcc相关依赖
# 在终端依次输入以下命令
yum -y install gcc
yum -y install gcc-c++
4.如果以前安装过docker 请卸载它们以及相关的依赖项
# 在终端输入以下命令
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
5.安装
yum-utils
包
[root@suzhongde suzhongde]# yum install -y yum-utils
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: mirrors.163.com
* updates: mirrors.cn99.com
Package yum-utils-1.1.31-54.el7_8.noarch already installed and latest version
Nothing to do
6.设置
稳定
的存储库
[root@suzhongde suzhongde]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks
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
7.配置yum源之后更新软件包的索引
[root@suzhongde suzhongde]# yum makecache fast
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: mirrors.163.com
* updates: mirrors.cn99.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): docker-ce-stable/7/x86_64/primary_db | 73 kB 00:00:05
docker-ce-stable/7/x86_64/upda FAILED
https://download.docker.com/linux/centos/7/x86_64/stable/repodata/65c4f66e2808d328890505c3c2f13bb35a96f457d1c21a6346191c4dc07e6080-updateinfo.xml.gz: [Errno 14] curl#51 - "Unable to communicate securely with peer: requested domain name does not match the server's certificate."
Trying other mirror.
Metadata Cache Created
8.
安装
Docker Engine
[root@suzhongde suzhongde]# yum -y install docker-ce docker-ce-cli containerd.io
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: mirrors.163.com
* updates: mirrors.cn99.com
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
---> 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
---> Package docker-ce-rootless-extras.x86_64 0:20.10.13-3.el7 will be installed
--> Processing De
版权声明:本文为qq_42654356原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。