Article
欧拉20.03LTS_SP3安装docker
随着时间车轮往前滚滚,Centos-7正逐渐的走下神坛,国内开源操作系统蓬勃发展,跟上时代的步伐,先把docker在欧拉上安装起来。
使用欧拉自带库非常容易安装,但是相对版本比较旧:18.09。还有就是,使用docker官网最新版,可以使用centos-8版本的库来进行安装。
这里两种方式都试了一下,关键步骤罗列如下:
# 欧拉自带
[root@localhost ~]# cat /etc/yum.repos.d/openEuler.repo
[root@localhost ~]# yum search docker
[root@localhost ~]# yum list | grep docker
docker-engine.x86_64 18.09.0-206.oe1 OS
# 默认已经disabled
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# cat /etc/sysconfig/selinux
# 安装
[root@localhost ~]# yum install docker
Last metadata expiration check: 1:22:48 ago on Thu 13 Jan 2022 10:19:38 AM CST.
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
docker-engine x86_64 18.09.0-206.oe1 OS 45 M
Installing dependencies:
libcgroup x86_64 0.42.2-1.oe1 OS 96 k
Transaction Summary
================================================================================================================================================================
Install 2 Packages
[root@localhost ~]# docker version
Client:
Version: 18.09.0
EulerVersion: 18.09.0.206
API version: 1.39
Go version: go1.15.7
Git commit: e4c0fb8
Built: Fri Dec 31 21:47:09 2021
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.09.0
EulerVersion: 18.09.0.206
API version: 1.39 (minimum version 1.12)
Go version: go1.15.7
Git commit: e4c0fb8
Built: Fri Dec 31 21:46:37 2021
OS/Arch: linux/amd64
Experimental: false
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
# 安装最新版
- https://docs.docker.com/engine/install/centos/
- https://blog.csdn.net/Jairoguo/article/details/118403323
# 安装包repo的国内源
- aliyun源:
dnf config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
- huawei源:
sudo yum-config-manager \
--add-repo \
https://repo.huaweicloud.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+repo.huaweicloud.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
# 问题1:$releasever
[root@localhost ~]# yum search docker
Docker CE Stable - x86_64 240 B/s | 394 B 00:01
Errors during downloading metadata for repository 'docker-ce-stable':
- Status code: 404 for https://download.docker.com/linux/centos/20.03LTS_SP3/x86_64/stable/repodata/repomd.xml (IP: 13.224.160.26)
Error: Failed to download metadata for repo 'docker-ce-stable': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
解决:
跟centos的对不上,直接用centos-8的版本,把 $releasever 改成 8 :
[root@localhost ~]# cat /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS-SP3)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS-SP3)"
ANSI_COLOR="0;31"
[root@localhost ~]# arch
x86_64
# 修改release-version版本为8:
vi /etc/yum.repos.d/docker-ce.repo
:%s/$releasever/8/g
# 问题2:Base依赖
- cannot install the best candidate for the job
- nothing provides fuse-overlayfs >= 0.7 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
- nothing provides slirp4netns >= 0.4 needed by docker-ce-rootless-extras-20.10.0-3.el8.x86_64
解决:
添加centos-base库,同样替换成centos-8的版本。
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-8-reg.repo
[root@localhost ~]# vi /etc/yum.repos.d/CentOS-Base.repo
:%s/$releasever/8/g
# 正式安装
[root@localhost ~]# yum install docker-ce docker-ce-cli containerd.io
CentOS-8 - Base - repo.huaweicloud.com 583 kB/s | 4.6 MB 00:08
CentOS-8 - AppStream - repo.huaweicloud.com 565 kB/s | 8.4 MB 00:15
CentOS-8 - PowerTools - repo.huaweicloud.com 626 kB/s | 2.3 MB 00:03
CentOS-8 - Extras - repo.huaweicloud.com 43 kB/s | 10 kB 00:00
Dependencies resolved.
================================================================================================================================================================
Package Architecture Version Repository Size
================================================================================================================================================================
Installing:
containerd.io x86_64 1.4.12-3.1.el8 docker-ce-stable 28 M
docker-ce x86_64 3:20.10.12-3.el8 docker-ce-stable 22 M
docker-ce-cli x86_64 1:20.10.12-3.el8 docker-ce-stable 30 M
Upgrading:
selinux-policy noarch 3.14.3-80.el8_5.2 BaseOS 636 k
selinux-policy-targeted noarch 3.14.3-80.el8_5.2 BaseOS 15 M
Installing dependencies:
container-selinux noarch 2:2.167.0-1.module_el8.5.0+911+f19012f9 AppStream 54 k
docker-ce-rootless-extras x86_64 20.10.12-3.el8 docker-ce-stable 4.6 M
docker-scan-plugin x86_64 0.12.0-3.el8 docker-ce-stable 3.7 M
fuse-overlayfs x86_64 1.7.1-1.module_el8.5.0+890+6b136101 AppStream 73 k
fuse3 x86_64 3.9.2-8.oe1 OS 112 k
libcgroup x86_64 0.42.2-1.oe1 OS 96 k
libslirp x86_64 4.4.0-1.module_el8.5.0+890+6b136101 AppStream 70 k
slirp4netns x86_64 1.1.8-1.module_el8.5.0+890+6b136101 AppStream 51 k
Installing weak dependencies:
fuse3-help x86_64 3.9.2-8.oe1 OS 14 k
Enabling module streams:
container-tools rhel8
Transaction Summary
================================================================================================================================================================
Install 12 Packages
Upgrade 2 Packages
Total download size: 105 M
# 使用
[root@localhost ~]# docker version
Client: Docker Engine - Community
Version: 20.10.12
API version: 1.41
Go version: go1.16.12
Git commit: e91ed57
Built: Mon Dec 13 11:45:22 2021
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.12
API version: 1.41 (minimum version 1.12)
Go version: go1.16.12
Git commit: 459d0df
Built: Mon Dec 13 11:43:44 2021
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.12
GitCommit: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
runc:
Version: 1.0.2
GitCommit: v1.0.2-0-g52b36a2
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
[root@localhost ~]# docker pull centos:7
7: Pulling from library/centos
2d473b07cdd5: Pull complete
Digest: sha256:9d4bcbbb213dfd745b58be38b13b996ebb5ac315fe75711bd618426a630e0987
Status: Downloaded newer image for centos:7
docker.io/library/centos:7
[root@localhost ~]#
[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 7 eeb6ee3f44bd 3 months ago 204MB
[root@localhost ~]# docker run --rm centos:7 hostname
3c7a047ec95e
[root@localhost ~]# docker run --rm centos:7 date
Thu Jan 13 03:33:12 UTC 2022
# docker镜像加速
- https://www.runoob.com/docker/docker-mirror-acceleration.html
- https://mirrors.ustc.edu.cn/help/dockerhub.html
添加镜像配置:
# https://docker.mirrors.ustc.edu.cn/
# https://hub-mirror.c.163.com
# https://reg-mirror.qiniu.com
[root@localhost ~]# cat /etc/docker/daemon.json
{
"registry-mirrors":["https://reg-mirror.qiniu.com/"]
}
[root@localhost ~]# service docker restart
Redirecting to /bin/systemctl restart docker.service
[root@localhost ~]# docker info
Registry Mirrors:
https://reg-mirror.qiniu.com/
运行一个hello-world看看速度:
[root@localhost ~]# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:975f4b14f326b05db86e16de00144f9c12257553bba9484fed41f9b6f2257800
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
(amd64)
3. The Docker daemon created a new container from that image which runs the
executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
to your terminal.
To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/
For more examples and ideas, visit:
https://docs.docker.com/get-started/
–END
Related
Related posts
-
杀鸡焉用牛刀:DuckDB 正取代部分 Spark 场景
2026-02-16
-
WIN 挂载 S3:像本地文件夹一样用对象存储
2026-02-10
-
n8n 终于还是部署到 Docker 了,经验就是要反反复复地去验证:要想少走弯路,就按官方推荐的最佳实践
2025-12-29
-
无需 Docker:n8n 2.x internal 模式下 Python Task Runner 配置实践
2025-12-25