简介
由于部署服务器切换成基于ARM的架构,对应的,在编译的版本镜像也必须基于ARM架构的,因此需要在ARM的服务器上安装docker版本并打包docker镜像然后才能在其他ARM的服务器下进行部署。好消息是,docker版本就有ARM版本。
安装
先看看服务器的版本
[root@Kylin /]# uname -a
Linux ecs-5725 4.19.90-17.5.ky10.aarch64 #1 SMP Fri Aug 7 13:35:33 CST 2020 aarch64 aarch64 aarch64 GNU/Linux
这台是中标麒麟服务器,是标准的aarch64指令集的ARM架构服务器。kylin服务器是基于redhat版本的,基本可以等同于centos,所以熟悉centos的朋友操作麒麟应该非常熟练。
由于在线安装的方式,会遇到各种包缺失等提示(ARM架构的生态目前还比不上x86的便利),所以这里选用离线安装的方式。
下载相关文件,认准aarch64标识,noarch代表全架构支持
wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
wget https://download.docker.com/linux/centos/8/aarch64/stable/Packages/containerd.io-1.4.3-3.1.el8.aarch64.rpm
wget https://download.docker.com/linux/centos/8/aarch64/stable/Packages/docker-ce-cli-19.03.14-3.el8.aarch64.rpm
wget https://download.docker.com/linux/centos/8/aarch64/stable/Packages/docker-ce-19.03.14-3.el8.aarch64.rpm
依次安装,安装是有顺序,请安装下面顺序安装,不然会报各种错误
rpm -ivh container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm
yum install -y containerd.io-1.4.3-3.1.el8.aarch64.rpm
yum install -y docker-ce-cli-19.03.14-3.el8.aarch64.rpm
yum install -y docker-ce-19.03.14-3.el8.aarch64.rpm
启动docker
sudo systemctl start docker
查看,可以看到 Architecture: aarch64 这一行代表是ARM架构的docker
[root@Kylin /]# docker info
Client:
Debug Mode: false
Server:
Containers: 2
Running: 1
Paused: 0
Stopped: 1
Images: 9
Server Version: 19.03.14
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
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: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.19.90-17.5.ky10.aarch64
Operating System: Kylin Linux Advanced Server V10 (Tercel)
OSType: linux
Architecture: aarch64
CPUs: 4
Total Memory: 15.39GiB
Name: ecs-5725
ID: W7U7:LZIF:RT5Q:S4S4:SIK3:PZMU:OGXB:2NB2:YJVT:M7RL:VIYY:JMO2
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
测试hello word
[root@Kylin /]# sudo docker run hello-world
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.
(arm64v8)
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/
总结
由于docker官方就有ARM发行版,所以安装起来算是比较顺利的,唯一要注意的是根据自己服务器选定好对应的docker版本,同时注意docker组件的安装顺序。
网友评论