🦄 🎐个人主页 🎐✨🍁
🪁🍁🪁🍁🪁🍁 感谢点赞和关注 ,每天进步一点点!加油!🪁🍁🪁🍁🪁🍁
目录
一、环境配置
二、安装Docker
三、错误解决
3.1 报错---yum 源配置
3.1.1 报错信息
3.1.2 解决
3.2 报错---podman和buildah
3.2.1 报错信息
3.2.2 解决
一、环境配置
- 操作系统:CentOS Linux release 8.4.2105
- Docker Version: 24.0.6
# 更新镜像源, Centos8 由yum 升级为dnf两个都可使用,yum源需可用
# 安装NTP
dnf install chrony
# 修改chrony配置文件指定NTP源为阿里NTP
sed -r -i 's?^pool.+iburst?pool ntp.aliyun.com iburst?' /etc/chrony.conf
# 重启chrony服务
systemctl restart chronyd
# 开机自动启动chrony服务
systemctl enable chronyd
# 查看时间服务器状态
chronyc sources -v
# 创建docker目录
mkdir -p /etc/docker /opt/docker
# 创建docker配置文件
tee /etc/docker/daemon.json <<-'EOF'
{
"data-root": "/opt/docker",
"log-driver": "json-file",
"log-opts": {
"max-size": "800m",
"max-file": "50"
},
"registry-mirrors": [
"https://b9pmyelo.mirror.aliyuncs.com"
]
}
EOF
相关文章:
【Linux】NTP时间服务器Chrony配置详解_开着拖拉机回家的博客-CSDN博客
【容器化】Docker-compose教程(安装,使用, 快速入门)_docker-compose安装-CSDN博客
二、安装Docker
# 安装镜像源配置工具
dnf install -y yum-utils
# 添加软件源
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
# 安装docker
# 离线安装用户可以在这里执行dnf download --resolve docker-ce docker-ce-cli containerd.io下载所有包
dnf install docker-ce docker-ce-cli containerd.io
# 启动docker
systemctl start docker
# docker开机自动启动
systemctl enable docker
# containerd容器开机自动启动
systemctl enable containerd
# 查看docker版本信息
docker info
成功启动
三、错误解决
3.1 报错---yum 源配置
3.1.1 报错信息
执行 yum 安装报错如下:
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist
原因:Centos8于2021年年底停止了服务,我们在使用yum源安装时候,出现下面错误“错误:Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist”。
3.1.2 解决
进入yum的repos目录
cd /etc/yum.repos.d/
修改所有的CentOS文件内容,最好是全部备份后再修改
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
yum 可以正常使用
3.2 报错---podman和buildah
3.2.1 报错信息
安装 docker 报错信息如下:
[root@tdh-node01 yum.repos.d]# dnf install docker-ce docker-ce-cli containerd.io
Last metadata expiration check: 0:01:45 ago on Tue 24 Oct 2023 10:50:35 AM CST.
Error:
Problem 1: problem with installed package podman-3.0.1-6.module_el8.4.0+781+acf4c33b.x86_64
- package podman-3.0.1-6.module_el8.4.0+781+acf4c33b.x86_64 requires runc >= 1.0.0-57, but none of the providers can be installed
- package podman-3.3.1-9.module_el8.5.0+988+b1f0b741.x86_64 requires runc >= 1.0.0-57, but none of the providers can be installed
- package containerd.io-1.6.24-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64
- package containerd.io-1.6.24-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.0-70.rc92.module_el8.4.0+673+eabfc99d.x86_64
- package containerd.io-1.6.24-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.24-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- cannot install the best candidate for the job
- package runc-1.0.0-66.rc10.module_el8.5.0+1004+c00a74f5.x86_64 is filtered out by modular filtering
- package runc-1.0.0-72.rc92.module_el8.5.0+1006+8d0e68a2.x86_64 is filtered out by modular filtering
Problem 2: problem with installed package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64
- package buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed
- package buildah-1.22.3-2.module_el8.5.0+911+f19012f9.x86_64 requires runc >= 1.0.0-26, but none of the providers can be installed
- package docker-ce-3:24.0.6-1.el8.x86_64 requires containerd.io >= 1.6.4, but none of the providers can be installed
- package containerd.io-1.6.10-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.10-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.11-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.11-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.12-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.12-3.1.el8.x86_64 obsoletes runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
- package containerd.io-1.6.13-3.1.el8.x86_64 conflicts with runc provided by runc-1.0.2-1.module_el8.5.0+911+f19012f9.x86_64
环境信息如下:
[root@tdh-node02 yum.repos.d]# cat /etc/redhat-release
CentOS Linux release 8.4.2105
[root@tdh-node02 yum.repos.d]#
[root@tdh-node02 yum.repos.d]# uname -a
Linux tdh-node02 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
[root@tdh-node02 yum.repos.d]#
[root@tdh-node02 yum.repos.d]# rpm -q podman
podman-3.0.1-6.module_el8.4.0+781+acf4c33b.x86_64
[root@tdh-node02 yum.repos.d]#
[root@tdh-node02 yum.repos.d]# rpm -q buildah
buildah-1.19.7-1.module_el8.4.0+781+acf4c33b.x86_64
3.2.2 解决
移除冲突的包podman和buildah
sudo yum erase podman buildah
安装成功
参考文章:
【精选】Centos8安装Docker_centos8 安装docker_Halyace的博客-CSDN博客
解决Centos8报Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorlist:...错误_centos8 error: failed to download metadata for rep-CSDN博客文章来源:https://www.toymoban.com/news/detail-714110.html
docker: problem with installed package podman-3.0.1-6.module_el8.4.0+781+acf4c33b.x86_64-CSDN博客文章来源地址https://www.toymoban.com/news/detail-714110.html
到了这里,关于【Linux】CentOS8.4 安装docker的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!