https://www.jianshu.com/p/758c170b951f
1.如果系统中有老版本的docker,我们需要删除之前的docker 以及依赖
sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
2.安装依赖包
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
3.配置阿里docker源
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
出现以下内容则表示docker仓库配置成功:
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
4.安装最新社区版docker
sudo yum install docker-ce docker-ce-cli containerd.io
5.启动docker 服务
systemctl start docker
6.运行hello-world镜像,来检测docker 是否安装成功
sudo docker run hello-world
出现Hello from Docker 就代表成功
来源:oschina
链接:https://my.oschina.net/u/3966437/blog/4283541