去年12 月 8 日,CentOS 开发团队在其官博宣布,CentOS 8 将在 2021 年 12 月 31 日结束支持,CentOS 7 会按照计划维护至生命周期结束即 2024 年 6 月 30 日,接下来接下来将重点建设 CentOS Stream。免费的RedHat没有了,但生活还得继续。
接下来我的目光转向openEuler,openEuler 是一个开源、免费的 Linux 发行版平台,将通过开放的社区形式与全球的开发者共同构建一个开放、多元和架构包容的软件生态体系。它由华为公司开源,众多国内企业也积极加入到openEuler社区,其社区发展之速度令人吃惊,堪称是中国开源领域的里程碑。
官方安装方法
给出了3种安装方法:
● 从Docker的存储库中安装(https://docs.docker.com/engine/install/centos/#install-using-the-repository)
● 下载RPM包并手动安装(https://docs.docker.com/engine/install/centos/#install-from-a-package)
● 使用自动化脚本(https://docs.docker.com/engine/install/centos/#install-using-the-convenience-script)
添加yum源
cat <<'EOF'> /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-stable-debuginfo]
name=Docker CE Stable - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-stable-source]
name=Docker CE Stable - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/stable
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test]
name=Docker CE Test - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test-debuginfo]
name=Docker CE Test - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-test-source]
name=Docker CE Test - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/test
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly]
name=Docker CE Nightly - $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-debuginfo]
name=Docker CE Nightly - Debuginfo $basearch
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/debug-$basearch/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
[docker-ce-nightly-source]
name=Docker CE Nightly - Sources
baseurl=https://repo.huaweicloud.com/docker-ce/linux/centos/7/source/nightly
enabled=0
gpgcheck=1
gpgkey=https://repo.huaweicloud.com/docker-ce/linux/centos/gpg
EOF
然后更新建立缓存:
yum makecache
安装最新版本的Docker Engine和containerd
- 安装最新版
yum install docker-ce docker-ce-cli containerd.io -y
- 安装指定版本
yum install --downloadonly --downloaddir=./docker-rpm docker-ce-24.0.7 docker-ce-cli-24.0.7 containerd.io-1.6.26
配置docker
mkdir -p /etc/docker
mkdir -p /data/docker_data
cat <<'EOF'> /etc/docker/daemon.json
{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"exec-opts": ["native.cgroupdriver=systemd"],
"data-root": "/data/docker_data",
"log-driver": "json-file",
"log-opts": {"max-size":"500m", "max-file":"3"},
"insecure-registries": ["10.3.36.6:7890"],
"dns": ["180.76.76.76","119.29.29.29"]
}
EOF
systemctl daemon-reload
systemctl restart docker
启动docker
systemctl enable docker
systemctl status docker
参考
https://blog.csdn.net/Jairoguo/article/details/118403323
报错
[root@master01 yum.repos.d]# dnf install docker-ce-24.0.7 docker-ce-cli-24.0.7 containerd.io-1.6.26
Last metadata expiration check: 0:30:00 ago on Sun 21 Jan 2024 06:10:29 PM CST.
Dependencies resolved.
Problem: package docker-ce-3:24.0.7-1.el7.x86_64 requires docker-ce-rootless-extras, but none of the providers can be installed
- conflicting requests
- nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.0-3.el7.x86_64
- nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.0-3.el7.x86_64
参考链接:
https://stackoverflow.com/questions/65878769/cannot-install-docker-in-a-rhel-server
https://www.cnblogs.com/murencao/p/17555846.html