Centos7 安装Docker 详细多图版_centos7安装docker-CSDN博客https://blog.csdn.net/qq_15752347/article/details/132461033?ops_request_misc=&request_id=&biz_id=102&utm_term=centos7%E5%AE%89%E8%A3%85docker&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-0-132461033.142^v100^pc_search_result_base9&spm=1018.2226.3001.4187
解决CenOS7安装docker报错:container-selinux >= 2:2.74_container-selinux >= 2:2.74-CSDN博客https://blog.csdn.net/weixin_41887742/article/details/129010105?ops_request_misc=&request_id=&biz_id=102&utm_term=%E9%94%99%E8%AF%AF%EF%BC%9A%E8%BD%AF%E4%BB%B6%E5%8C%85%EF%BC%9Acontainerd.io-1.6.33-3.&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduweb~default-2-129010105.142^v100^pc_search_result_base9&spm=1018.2226.3001.4187
57 | Cannot find a valid baseurl for repo: base/7/x86_64-CSDN博客
Cannot find a valid baseurl for repo: base/7/x86_6
3.1.1 进入到/etc/repos.d目录
cd /etc/yum.repos.d
3.1.2 修改CentOS-Media.repo
vi CentOS-Media.repo
修改内容
Cannot find a valid baseurl for repo: base/7/x86_6
baseurl=file:///mnt/cdrom/
file:///media/cdrecorder/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
3.1.3 备份yum源
mv CentOS-Base.repo CentOS-Base.repo.bak
3.1.4 创建挂载点
mkdir /mnt/cdrom //创建挂载点
mount /dev/cdrom /mnt/cdrom //将文件挂载到创建的挂载点上
3.1.5 更新yum源
yum clean all
yum makecache
3.1.6 最后再去修改CentOS-Media.repo
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
执行命令yum install docker-ce时报错
错误:软件包:3:docker-ce-23.0.1-1.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
错误:软件包:containerd.io-1.6.16-3.1.el7.x86_64 (docker-ce-stable)
需要:container-selinux >= 2:2.74
您可以尝试添加 --skip-broken 选项来解决该问题
您可以尝试执行:rpm -Va --nofiles --nodigest
解决
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
安装docker
首先需要大家虚拟机联网,安装yum工具
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.repo
sed -i 's/download.docker.com/mirrors.aliyun.com\/docker-ce/g' /etc/yum.repos.d/docker-ce.repo
yum makecache fast
yum install -y docker-ce