[转]openEuler 22.03 (LTS-SP1)安装最新版Docker(踩坑及解决方案)

原文地址:openEuler 22.03 (LTS-SP1)安装最新版Docker(踩坑及解决方案)_openeuler docker-CSDN博客

openEuler 22.03 LTS-SP1要是直接yum install docker,默认安装docker 是18.09.0,这个版本Docker有个bug,所以还是安装个最新版Docker。

1、先增加docker官方仓库

[root@apisql yum.repos.d]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
添加仓库自:https://download.docker.com/linux/centos/docker-ce.repo
以下作踩坑过程,请直接跳过查看下面的"2、修改配置文件"
查看一下最新版docker,然后报错可以发现,

[root@apisql yum.repos.d]# yum list docker-ce --showduplicates|sort -r
Errors during downloading metadata for repository 'docker-ce-stable':
- Curl error (35): SSL connect error for https://download.docker.com/linux/centos/22.03LTS_SP1/x86_64/stable/repodata/repomd.xml [OpenSSL SSL_connect: Connection reset by peer in connection to download.docker.com:443 ]
Error: 为仓库 'docker-ce-stable' 下载元数据失败 : Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Docker CE Stable - x86_64 0.0 B/s | 0 B 00:00
[root@apisql yum.repos.d]#
这里只有centos/7/ 或 centos/8/ 的目录

 

没有22.03LTS_SP的目录的

 

问了一下bing:华为openEuler-22.03-LTS-SP1 对应 centos什么版本?
华为openEuler-22.03-LTS-SP1 对应的 CentOS 版本是 CentOS 7.91。如果您需要更多关于 openEuler 的信息,可以访问 openEuler社区官网。


2、修改配置文件

所以我们进入/etc/yum.repos.d/目录

[root@apisql ~]# cd /etc/yum.repos.d/
[root@apisql yum.repos.d]# ll -l
总用量 8
-rw-r--r--. 1 root root 1919 6月 14 15:13 docker-ce.repo
-rw-r--r--. 1 root root 1957 12月 27 22:25 openEuler.repo
[root@apisql yum.repos.d]# vi docker-ce.repo
编辑 docker-ce.repo 文件

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
将$releasever 换为 7

[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://download.docker.com/linux/centos/7/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://download.docker.com/linux/centos/gpg
也可以批量查询替换

:1,$s/\$releasever/7/g
其中,:1,$ 表示从第一行到最后一行,s 表示替换操作,\$releasever 表示要被替换的字符串,7 表示替换后的字符串,/g 全局

[root@apisql yum.repos.d]# yum list docker-ce --showduplicates|sort -r
docker-ce.x86_64 3:24.0.2-1.el7 docker-ce-stable
docker-ce.x86_64 3:24.0.1-1.el7 docker-ce-stable
docker-ce.x86_64 3:24.0.0-1.el7 docker-ce-stable
docker-ce.x86_64 3:23.0.6-1.el7 docker-ce-stable
……
……
Docker CE Stable - x86_64 40 kB/s | 60 kB 00:01
Available Packages
[root@apisql yum.repos.d]#
3、再来安装指定版本

[root@apisql yum.repos.d]# yum -y install docker-ce-24.0.2
======================================================================================================================== Package Architecture Version Repository Size
========================================================================================================================Installing:
docker-ce x86_64 3:24.0.2-1.el7 docker-ce-stable 24 M
Installing dependencies:
container-selinux noarch 2:2.138-4.oe2203sp1 OS 37 k
containerd.io x86_64 1.6.21-3.1.el7 docker-ce-stable 34 M
docker-buildx-plugin x86_64 0.10.5-1.el7 docker-ce-stable 12 M
docker-ce-cli x86_64 1:24.0.2-1.el7 docker-ce-stable 13 M
docker-ce-rootless-extras x86_64 24.0.2-1.el7 docker-ce-stable 9.1 M
docker-compose-plugin x86_64 2.18.1-1.el7 docker-ce-stable 12 M
fuse-overlayfs x86_64 1.9-1.oe2203sp1 EPOL 62 k
fuse3 x86_64 3.10.5-5.oe2203sp1 OS 115 k
libcgroup x86_64 2.0.3-1.oe2203sp1 update 100 k
libslirp x86_64 4.7.0-2.oe2203sp1 OS 71 k
slirp4netns x86_64 1.2.0-1.oe2203sp1 EPOL 47 k
tar x86_64 2:1.34-4.oe2203sp1 update 785 k
Installing weak dependencies:
fuse3-help x86_64 3.10.5-5.oe2203sp1 OS 14 k

Transaction Summary
========================================================================================================================Install 14 Packages

Total download size: 106 M
Installed size: 376 M

最后启动docker服务,检查一下,安装完成


[root@apisql yum.repos.d]# systemctl start docker
[root@apisql yum.repos.d]# systemctl enable docker
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@apisql yum.repos.d]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@apisql yum.repos.d]# docker --version
Docker version 24.0.2, build cb74dfc

————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/weixin_42465759/article/details/131207667

posted @ 2024-05-07 15:24  dirgo  阅读(1115)  评论(0编辑  收藏  举报