环境版本:
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
安装Docker-ce步骤:
1.移除旧的版本:
$ sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
2.安装一些必要的系统工具:
$ sudo yum install -y yum-utils device-mapper-persistent-data lvm2
3.添加软件源信息(示例为阿里云):
$ sudo yum-config-manager –add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新 yum 缓存: $ sudo yum makecache fast
5.安装 Docker-ce: $ sudo yum -y install docker-ce
6.启动 Docker 后台服务: $ sudo systemctl start docker
7.查看安装后的docker版本:
# yum list installed | grep docker
containerd.io.x86_64 1.2.5-3.1.el7 @docker-ce-stable
docker-ce.x86_64 3:18.09.6-3.el7 @docker-ce-stable
docker-ce-cli.x86_64 1:18.09.6-3.el7 @docker-ce-stable
附录:安装特定版本docker-ce
1.下载rpm包https://download.docker.com/linux/centos/7/x86_64/stable/Packages/
2.安装rpm包
yum install -y /path/docker-cexxx.rpm
或使用如下方法安装特定版本(示例为 17.09.0 ):
yum list docker-ce –showduplicates|sort -r
yum install docker-ce-17.09.0.ce-1.el7.cnetos -y