1、如果之前安装过则先进行卸载。(可选项)
yum remove docker \
> > docker-client \
> > docker-client-latest \
> > docker-common \
> > docker-latest \
> > docker-latest-logrotate \
> > docker-logrotate \
> > docker-engine
No Match for argument: docker
2、清除源缓存信息并更新
yum clean all
yum makecache
3、安装依赖包
yum install -y yum-utils device-mapper-persistent-data lvm2
4、设置国内源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
5、执行安装
yum install docker-ce docker-ce-cli containerd
6、进行配置
vim /etc/docker/daemon.json
添加以下内容:
{
"registry-mirrors": [
"https://docker.m.daocloud.io"
]
}
7.进行启动和查看版本号
①配置docker开机自启
sudo systemctl enable docker
②启动docker
sudo systemctl start docker.service
③检查是否按照完毕
docker version