一、
如果自己以前安装的docker有残留,不想要了,可以使用下面命令卸载:
yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-selinux \docker-engine-selinux \docker-engine \docker-ce
二、
记得联网,然后在虚拟机上执行下面命令:
yum install -y yum-utils \device-mapper-persistent-data \lvm2 --skip-broken
三、
由于拉取镜像要求国外网站很慢,所以配置一个源:
# 设置docker镜像源
yum-config-manager \--add-repo \https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.reposed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repoyum makecache fast
四、
拉取:
yum install -y docker-ce
五、
为了后续的学习建议直接关闭防火墙,云服务器的可以不关,用到哪个端口开哪个:
# 关闭
systemctl stop firewalld
# 禁止开机启动防火墙
systemctl disable firewalld
六、
启动:
systemctl start docker # 启动docker服务systemctl stop docker # 停止docker服务systemctl restart docker # 重启docker服务
七、
查出来版本号就算成功了:
docker -v
八、
docker官方镜像仓库网速较差,我们需要设置国内镜像服务:
参考阿里云的镜像加速文档:https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors