利用vagrant工具在VirtualBox安装CentOS7环境后,安装Docker环境遇到的坑
前期准备工作
1、卸载原有环境
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
如果报错缺啥就安装啥
使用 wget
工具从阿里云镜像站点下载 CentOS 7 的仓库配置文件,并将其保存为 /etc/yum.repos.d/CentOS-Base.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum install epel-release
yum makecache
设置阿里云镜像
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
安装docker CE
sudo yum install -y docker-ce docker-ce-cli containerd.io
如果报错缺包,缺哪个就执行下面哪个,网上一堆帖子中的地址镜像仓库许多已经失效没有,会下载失败,那么就去以下提供的网址去找,
https://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/Packages/
缺哪个就从以上网址找执行
sudo yum install -y https://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/Packages/container-selinux-2.119.1-1.c57a6f9.el7.noarch.rpm
sudo yum install -y https://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/Packages/slirp4netns-0.4.3-4.el7_8.x86_64.rpm
sudo yum install -y https://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/Packages/fuse3-libs-3.6.1-4.el7.x86_64.rpm
sudo yum install -y https://mirrors.aliyun.com/centos/7.9.2009/extras/x86_64/Packages/fuse-overlayfs-0.7.2-6.el7_8.x86_64.rpm
最后再执行
sudo yum install -y docker-ce docker-ce-cli containerd.io
安装成功完毕