银河麒麟操作系统 v10 中离线安装 Docker

linmengmeng_1314 2024-07-14 16:37:01 阅读 54

银河麒麟操作系统 v10 中离线安装 Docker

1. 查看系统版本2. 查看 Linux 内核版本(3.10以上)3. 查看 iptabls 版本(1.4以上)4. 判断处理器架构5. 离线下载 Docker 安装包6. 移动解压出来的二进制文件到 /usr/bin 目录中7. 配置 Docker 服务7.1 编辑 docker 的系统服务文件7.2 将下面的内容复制到刚创建的docker.service文件中7.3 为docker.service添加执行权限7.4 编辑daemon.json7.5 启动 Docker7.6 添加开机自动启动

8. 安装 docker-compose

1. 查看系统版本

<code>[root@localhost opt]# cat /etc/os-release

NAME="Kylin Linux Advanced Server"code>

VERSION="V10 (Lance)"code>

ID="kylin"code>

VERSION_ID="V10"code>

PRETTY_NAME="Kylin Linux Advanced Server V10 (Lance)"code>

ANSI_COLOR="0;31"code>

[root@localhost opt]#

2. 查看 Linux 内核版本(3.10以上)

[root@localhost opt]# uname -r

4.19.90-52.22.v2207.ky10.aarch64

[root@localhost opt]# uname -a

Linux localhost.localdomain 4.19.90-52.22.v2207.ky10.aarch64 #1 SMP Tue Mar 14 11:52:45 CST 2023 aarch64 aarch64 aarch64 GNU/Linux

[root@localhost opt]#

3. 查看 iptabls 版本(1.4以上)

[root@localhost opt]# iptables --version

iptables v1.8.5 (legacy)

4. 判断处理器架构

[root@localhost opt]# uname -p

aarch64

[root@localhost opt]#

可以看到,系统处理器架构为 ARM 架构;如果为 x86 架构的,则会显示 x86_64;

5. 离线下载 Docker 安装包

https://download.docker.com/linux/static/stable/

在这里插入图片描述

点进去,选择想要安装的版本,我这里为了跟测试环境保持一致,下载了一个相对旧点的版本:<code>docker-20.10.6.tgz

下载完成后,上传至服务器 /opt 目录下,然后解压:tar -zxvf docker-20.10.6.tgz

6. 移动解压出来的二进制文件到 /usr/bin 目录中

mv docker/* /usr/bin/

然后就可以测试下Docker

[root@localhost opt]# docker -v

Docker version 20.10.6, build 370c289

[root@localhost opt]#

[root@localhost opt]# docker version

Client:

Version: 20.10.6

API version: 1.41

Go version: go1.13.15

Git commit: 370c289

Built: Fri Apr 9 22:42:28 2021

OS/Arch: linux/arm64

Context: default

Experimental: true

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

[root@localhost opt]#

此时Docker 还没启动,只是可以看到Docker 的版本信息了。

测试 Docker 启动:

[root@localhost opt]# dockerd

INFO[2024-01-17T16:37:43.099979439+08:00] Starting up

WARN[2024-01-17T16:37:43.105526753+08:00] could not change group /var/run/docker.sock to docker: group docker not found

INFO[2024-01-17T16:37:43.107420618+08:00] libcontainerd: started new containerd process pid=38904

INFO[2024-01-17T16:37:43.107565679+08:00] parsed scheme: "unix" module=grpc

INFO[2024-01-17T16:37:43.107591219+08:00] scheme "unix" not registered, fallback to default scheme module=grpc

INFO[2024-01-17T16:37:43.107642999+08:00] ccResolverWrapper: sending update to cc: { [{ unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc

INFO[2024-01-17T16:37:43.107667279+08:00] ClientConn switching balancer to "pick_first" module=grpc

INFO[2024-01-17T16:37:43.132250984+08:00] starting containerd revision=05f951a3781f4f2c1911b05e61c160e9c30eaa8e version=v1.4.4

INFO[2024-01-17T16:37:43.179400349+08:00] loading plugin "io.containerd.content.v1.content"... type=io.containerd.content.v1

INFO[2024-01-17T16:37:43.179620610+08:00] loading plugin "io.containerd.snapshotter.v1.aufs"... type=io.containerd.snapshotter.v1

INFO[2024-01-17T16:37:43.183035159+08:00] loading plugin "io.containerd.snapshotter.v1.btrfs"... type=io.containerd.snapshotter.v1

INFO[2024-01-17T16:37:43.183499360+08:00] skip loading plugin "io.containerd.snapshotter.v1.btrfs"... error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.btrfs (xfs) must be a btrfs filesystem to be used with the btrfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1code>

INFO[2024-01-17T16:37:43.183991662+08:00] loading plugin "io.containerd.snapshotter.v1.devmapper"... type=io.containerd.snapshotter.v1

WARN[2024-01-17T16:37:43.184090582+08:00] failed to load plugin io.containerd.snapshotter.v1.devmapper error="devmapper not configured"code>

INFO[2024-01-17T16:37:43.184142322+08:00] loading plugin "io.containerd.snapshotter.v1.native"... type=io.containerd.snapshotter.v1

INFO[2024-01-17T16:37:43.184627063+08:00] loading plugin "io.containerd.snapshotter.v1.overlayfs"... type=io.containerd.snapshotter.v1

INFO[2024-01-17T16:37:43.184991004+08:00] loading plugin "io.containerd.snapshotter.v1.zfs"... type=io.containerd.snapshotter.v1

INFO[2024-01-17T16:37:43.185386025+08:00] skip loading plugin "io.containerd.snapshotter.v1.zfs"... error="path /var/lib/docker/containerd/daemon/io.containerd.snapshotter.v1.zfs must be a zfs filesystem to be used with the zfs snapshotter: skip plugin" type=io.containerd.snapshotter.v1code>

INFO[2024-01-17T16:37:43.185426025+08:00] loading plugin "io.containerd.metadata.v1.bolt"... type=io.containerd.metadata.v1

WARN[2024-01-17T16:37:43.185509726+08:00] could not use snapshotter devmapper in metadata plugin error="devmapper not configured"code>

INFO[2024-01-17T16:37:43.185534686+08:00] metadata content store policy set policy=shared

INFO[2024-01-17T16:37:43.192321664+08:00] loading plugin "io.containerd.differ.v1.walking"... type=io.containerd.differ.v1

INFO[2024-01-17T16:37:43.192369284+08:00] loading plugin "io.containerd.gc.v1.scheduler"... type=io.containerd.gc.v1

INFO[2024-01-17T16:37:43.192454304+08:00] loading plugin "io.containerd.service.v1.introspection-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192522964+08:00] loading plugin "io.containerd.service.v1.containers-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192558844+08:00] loading plugin "io.containerd.service.v1.content-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192588405+08:00] loading plugin "io.containerd.service.v1.diff-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192619525+08:00] loading plugin "io.containerd.service.v1.images-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192649145+08:00] loading plugin "io.containerd.service.v1.leases-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192680805+08:00] loading plugin "io.containerd.service.v1.namespaces-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192713545+08:00] loading plugin "io.containerd.service.v1.snapshots-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.192742805+08:00] loading plugin "io.containerd.runtime.v1.linux"... type=io.containerd.runtime.v1

INFO[2024-01-17T16:37:43.192931185+08:00] loading plugin "io.containerd.runtime.v2.task"... type=io.containerd.runtime.v2

INFO[2024-01-17T16:37:43.193127946+08:00] loading plugin "io.containerd.monitor.v1.cgroups"... type=io.containerd.monitor.v1

INFO[2024-01-17T16:37:43.193782948+08:00] loading plugin "io.containerd.service.v1.tasks-service"... type=io.containerd.service.v1

INFO[2024-01-17T16:37:43.193849968+08:00] loading plugin "io.containerd.internal.v1.restart"... type=io.containerd.internal.v1

INFO[2024-01-17T16:37:43.193969348+08:00] loading plugin "io.containerd.grpc.v1.containers"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194002468+08:00] loading plugin "io.containerd.grpc.v1.content"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194032788+08:00] loading plugin "io.containerd.grpc.v1.diff"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194063708+08:00] loading plugin "io.containerd.grpc.v1.events"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194096109+08:00] loading plugin "io.containerd.grpc.v1.healthcheck"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194130489+08:00] loading plugin "io.containerd.grpc.v1.images"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194159349+08:00] loading plugin "io.containerd.grpc.v1.leases"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194188669+08:00] loading plugin "io.containerd.grpc.v1.namespaces"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194216589+08:00] loading plugin "io.containerd.internal.v1.opt"... type=io.containerd.internal.v1

INFO[2024-01-17T16:37:43.194398649+08:00] loading plugin "io.containerd.grpc.v1.snapshots"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194442309+08:00] loading plugin "io.containerd.grpc.v1.tasks"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194473650+08:00] loading plugin "io.containerd.grpc.v1.version"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194501590+08:00] loading plugin "io.containerd.grpc.v1.introspection"... type=io.containerd.grpc.v1

INFO[2024-01-17T16:37:43.194767270+08:00] serving... address=/var/run/docker/containerd/containerd-debug.sock

INFO[2024-01-17T16:37:43.194847951+08:00] serving... address=/var/run/docker/containerd/containerd.sock.ttrpc

INFO[2024-01-17T16:37:43.194907571+08:00] serving... address=/var/run/docker/containerd/containerd.sock

INFO[2024-01-17T16:37:43.194936211+08:00] containerd successfully booted in 0.063779s

INFO[2024-01-17T16:37:43.203435713+08:00] parsed scheme: "unix" module=grpc

INFO[2024-01-17T16:37:43.203476293+08:00] scheme "unix" not registered, fallback to default scheme module=grpc

INFO[2024-01-17T16:37:43.203514214+08:00] ccResolverWrapper: sending update to cc: { [{ unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc

INFO[2024-01-17T16:37:43.203535454+08:00] ClientConn switching balancer to "pick_first" module=grpc

INFO[2024-01-17T16:37:43.204550216+08:00] parsed scheme: "unix" module=grpc

INFO[2024-01-17T16:37:43.204590876+08:00] scheme "unix" not registered, fallback to default scheme module=grpc

INFO[2024-01-17T16:37:43.204625736+08:00] ccResolverWrapper: sending update to cc: { [{ unix:///var/run/docker/containerd/containerd.sock <nil> 0 <nil>}] <nil> <nil>} module=grpc

INFO[2024-01-17T16:37:43.204647717+08:00] ClientConn switching balancer to "pick_first" module=grpc

INFO[2024-01-17T16:37:43.261073806+08:00] Loading containers: start.

INFO[2024-01-17T16:37:43.841747309+08:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address

INFO[2024-01-17T16:37:43.942240656+08:00] Firewalld: interface docker0 already part of docker zone, returning

INFO[2024-01-17T16:37:44.034537461+08:00] Loading containers: done.

INFO[2024-01-17T16:37:44.071730559+08:00] Docker daemon commit=8728dd2 graphdriver(s)=overlay2 version=20.10.6

INFO[2024-01-17T16:37:44.071914980+08:00] Daemon has completed initialization

INFO[2024-01-17T16:37:44.123180096+08:00] API listen on /var/run/docker.sock

可以看到 docker 可以正常启动,不过当前是在窗口中手动启动的,Ctrl + C,杀掉就好。

^CINFO[2024-01-17T16:38:04.425317678+08:00] Processing signal 'interrupt'

INFO[2024-01-17T16:38:04.426455381+08:00] stopping event stream following graceful shutdown error="<nil>" module=libcontainerd namespace=mobycode>

INFO[2024-01-17T16:38:04.426832962+08:00] Daemon shutdown complete

INFO[2024-01-17T16:38:04.426861062+08:00] stopping healthcheck following graceful shutdown module=libcontainerd

INFO[2024-01-17T16:38:04.426897042+08:00] stopping event stream following graceful shutdown error="context canceled" module=libcontainerd namespace=plugins.mobycode>

7. 配置 Docker 服务

7.1 编辑 docker 的系统服务文件

vi /usr/lib/systemd/system/docker.service

7.2 将下面的内容复制到刚创建的docker.service文件中

[Unit]

Description=Docker Application Container Engine

Documentation=https://docs.docker.com

After=network-online.target firewalld.service

Wants=network-online.target

[Service]

Type=notify

ExecStart=/usr/bin/dockerd

ExecReload=/bin/kill -s HUP $MAINPID

LimitNOFILE=infinity

LimitNPROC=infinity

TimeoutStartSec=0

Delegate=yes

KillMode=process

Restart=on-failure

StartLimitBurst=3

StartLimitInterval=60s

[Install]

WantedBy=multi-user.target

7.3 为docker.service添加执行权限

chmod +x /usr/lib/systemd/system/docker.service

7.4 编辑daemon.json

vi /etc/docker/daemon.json

并添加以下内容:

{

"registry-mirrors": ["https://registry.docker-cn.com"],

"exec-opts": ["native.cgroupdriver=systemd"]

}

保存后,执行:systemctl daemon-reload

7.5 启动 Docker

[root@localhost opt]# systemctl start docker

[root@localhost opt]#

[root@localhost opt]# docker ps

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES

[root@localhost opt]#

[root@localhost opt]# docker -v

Docker version 20.10.6, build 370c289

[root@localhost opt]#

[root@localhost opt]# docker info

Client:

Context: default

Debug Mode: false

Server:

Containers: 0

Running: 0

Paused: 0

Stopped: 0

Images: 0

Server Version: 20.10.6

Storage Driver: overlay2

Backing Filesystem: xfs

Supports d_type: true

Native Overlay Diff: true

userxattr: false

Logging Driver: json-file

Cgroup Driver: cgroupfs

Cgroup Version: 1

Plugins:

Volume: local

Network: bridge host ipvlan macvlan null overlay

Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog

Swarm: inactive

Runtimes: io.containerd.runtime.v1.linux runc io.containerd.runc.v2

Default Runtime: runc

Init Binary: docker-init

containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e

runc version:

init version: de40ad0

Security Options:

seccomp

Profile: default

Kernel Version: 4.19.90-52.22.v2207.ky10.aarch64

Operating System: Kylin Linux Advanced Server V10 (Lance)

OSType: linux

Architecture: aarch64

CPUs: 64

Total Memory: 252.8GiB

Name: localhost.localdomain

ID: JRHZ:QLCB:TIJQ:KEM4:Z56J:TFJN:WAAG:BT4T:S2IC:XVOM:VZNS:TU6U

Docker Root Dir: /var/lib/docker

Debug Mode: false

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

127.0.0.0/8

Live Restore Enabled: false

Product License: Community Engine

[root@localhost opt]#

正常启动。

7.6 添加开机自动启动

systemctl enable docker

Docker 安装 参考: https://blog.csdn.net/qq_30665009/article/details/125938033

8. 安装 docker-compose

直接 GitHub 下载:docker/compose 选择自己喜欢的版本,这里直接拉满,下载当前最新的版本:v2.24.0

在这里插入图片描述

这里根据自己的架构,选择对应的包,下载就好了。

<code>cp docker-compose-linux-aarch64 /usr/local/bin/docker-compose

chmod +x /usr/local/bin/docker-compose

查看版本

[root@localhost opt]# docker-compose -v

Docker Compose version v2.24.0

[root@localhost opt]#



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。