关于docker:在银河麒麟高级服务器操作系统V10上安装docker

2次阅读

共计 3422 个字符,预计需要花费 9 分钟才能阅读完成。

河汉麒麟高级服务器操作系统 V10 是针对企业级要害业务,适应虚拟化、云计算、大数据、工业互联网时代对主机系统可靠性、安全性、性能、扩展性和 实时性的需要,根据 CMMI 5 级规范研制的提供内生平安、云原生反对、国产 平台深刻优化、高性能、易治理的新一代自主服务器操作系统;同源反对飞腾、龙芯、申威、兆芯、海光、鲲鹏等自主平台;可撑持构建大型数据中心服务器高 可用集群、负载平衡集群、分布式集群文件系统、虚拟化利用和容器云平台等,可部署在物理服务器和虚拟化环境、公有云、私有云和混合云环境;利用于政府、国防、金融、教育、财税、公安、审计、交通、医疗、制作等畛域。

公司有个我的项目须要将零碎部署在 kylinos 上,刚开始还有点头疼,胆怯各种程序无奈装置和应用,等装置好服务器进行应用的时候发现这不就是基于 centos 的嘛,尽管基于哪个版本不晓得,然而能够测试的,于是我一顿操作,最初发现它是基于 Centos8 的,零碎内核版本是 4.19,问题不大,既然是基于 Centos8 的,那 Centos8 上能跑的程序,在这必定也能跑,而后我就开始了欢快(苦楚)的装置 docker 之旅了。

配置阿里云 Centos8 镜像源

之所以要配置 Centos8 的镜像源是因为在装置 docker 的时候须要额定的一些依赖,而这些依赖在麒麟官网的源外面是没有的。

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo

配置阿里云 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+' /etc/yum.repos.d/docker-ce.repo

定义 yum 变量 & 批改 repo

批改 centos 和 docker repo 文件中的 $releasevercentos_version,起因是在麒麟服务器操作系统 V10 中 $releasever 被批改为了 10,而咱们须要应用 centos 8 的镜像源,如果你不替换,基本上仓库的每一个地址都是 404。

echo "8" > /etc/yum/vars/centos_version
sed -i 's/$releasever/$centos_version/g' /etc/yum.repos.d/docker-ce.repo
sed -i 's/$releasever/$centos_version/g' /etc/yum.repos.d/CentOS-Base.repo

建设 yum 缓存

没啥可说的

yum makecache

查看 docker-ce 版本

yum list docker-ce --showduplicates | sort -r

docker-ce.x86_64               3:20.10.9-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.8-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.7-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.6-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.5-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.4-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.3-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.2-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.1-3.el8                 docker-ce-stable
docker-ce.x86_64               3:20.10.12-3.el8                docker-ce-stable
docker-ce.x86_64               3:20.10.11-3.el8                docker-ce-stable
docker-ce.x86_64               3:20.10.10-3.el8                docker-ce-stable
docker-ce.x86_64               3:20.10.0-3.el8                 docker-ce-stable
docker-ce.x86_64               3:19.03.15-3.el8                docker-ce-stable
docker-ce.x86_64               3:19.03.15-3.el8                @docker-ce-stable
docker-ce.x86_64               3:19.03.14-3.el8                docker-ce-stable
docker-ce.x86_64               3:19.03.13-3.el8                docker-ce-stable

装置 docker

这里要装置 docker-ce 19.03 版本,因为我在应用最新版 20.10 启动容器时呈现了未知的权限问题,而麒麟服务器操作系统材料绝对较少,我未能找到相应的解决方案,只好退而求其次,换到上一个稳固版本。

20.10 版本错误信息如下:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:318: starting container process caused "permission denied": unknown.
ERRO[0000] error waiting for container: context canceled

还是装置 19.03 版本吧。

yum install docker-ce-19.03.15 docker-ce-cli-19.03.15 containerd.io -y

启动 docker

systemctl start docker
systemctl enable docker

启动 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:2498fce14358aa50ead0cc6c19990fc6ff866ce72aeb5546e1d59caac3d0d60f
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/

完满应用 -:)

正文完
 0