新的
在x86机器上跑arm容器
1.拉取包
[root@localhost ~]# docker pull arm64v8/centos
Using default tag: latest
latest: Pulling from arm64v8/centos
52f9ef134af7: Pull complete
Digest: sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc
Status: Downloaded newer image for arm64v8/centos:latest
docker.io/arm64v8/centos:latest
2.启动失败
[root@localhost ~]# docker run -it --name=c1 arm64v8/centos /bin/bash
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
exec /bin/bash: exec format error
3.QEMU来虚拟出Arm的架构
下载连接:
https://github.com/multiarch/qemu-user-static/releases/download/v7.2.0-1/qemu-aarch64-static
下载之后相关操作
[root@localhost ~]# sudo cp qemu-aarch64-static /usr/bin/
[root@localhost ~]# sudo chmod +x /usr/bin/qemu-aarch64-static
4.运行arm容器
docker run --rm -it \
-v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
arm64v8/centos \
bash
5.检查版本
[root@97baca8a5021 /]# uname
Linux
[root@97baca8a5021 /]# uname -m
aarch64
6.arm64v8/centos连接
https://hub.docker.com/r/arm64v8/centos/
附件:测试拉取arm64v8/centos:7
进行yum安装,能正常安装。有提示
(31/33): vim-filesystem-7.4.629-8.el7_9.aarch64.rpm | 10 kB 00:00:00
(32/33): which-2.20-7.el7.aarch64.rpm | 40 kB 00:00:00
(33/33): vim-common-7.4.629-8.el7_9.aarch64.rpm | 5.9 MB 00:00:03
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.9 MB/s | 19 MB 00:00:09
warning: /var/cache/yum/aarch64/7/base/packages/perl-HTTP-Tiny-0.033-3.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Importing GPG key 0x305D49D6:
Userid : "CentOS AltArch SIG - AArch64 (http://wiki.centos.org/SpecialInterestGroup/AltArch/AArch64) <security@centos.org>"
Fingerprint: ef8f 3ca6 6efd f32b 36cd adf7 6c7c b6ef 305d 49d6
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : gpm-libs-1.20.7-6.el7.aarch64 1/33
Installing : 2:vim-filesystem-7.4.629-8.el7_9.aarch64
[root@3ae421615f51 yum.repos.d]# yum install vim -y
。。。。。。。。。
Dependency Installed:
gpm-libs.aarch64 0:1.20.7-6.el7 groff-base.aarch64 0:1.22.2-8.el7 perl.aarch64 4:5.16.3-299.el7_9 perl-Carp.noarch 0:1.26-244.el7
perl-Encode.aarch64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7 perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7
perl-Filter.aarch64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-3.el7 perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.aarch64 0:3.40-5.el7
perl-Pod-Escapes.noarch 1:1.04-299.el7_9 perl-Pod-Perldoc.noarch 0:3.20-4.el7 perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7
perl-Scalar-List-Utils.aarch64 0:1.27-248.el7 perl-Socket.aarch64 0:2.010-5.el7 perl-Storable.aarch64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7
perl-Time-HiRes.aarch64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7 perl-constant.noarch 0:1.27-2.el7 perl-libs.aarch64 4:5.16.3-299.el7_9
perl-macros.aarch64 4:5.16.3-299.el7_9 perl-parent.noarch 1:0.225-244.el7 perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.aarch64 0:1.87-4.el7
perl-threads-shared.aarch64 0:1.43-6.el7 vim-common.aarch64 2:7.4.629-8.el7_9 vim-filesystem.aarch64 2:7.4.629-8.el7_9 which.aarch64 0:2.20-7.el7
Complete!
更多相关信息
[root@3ae421615f51 yum.repos.d]# ll /etc/pki/rpm-gpg/
total 16
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-7
-rw-r--r--. 1 root root 1065 Oct 23 2020 RPM-GPG-KEY-CentOS-7-aarch64
-rw-r--r--. 1 root root 1004 Oct 23 2020 RPM-GPG-KEY-CentOS-Debug-7
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-Testing-7
拉取指定版本测试:
docker pull arm64v8/centos:7.9.2009
docker run --rm -it \
-v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
arm64v8/centos:7.9.2009 \
bash
安装vim,有相关提示,但是能正常安装
(33/33): vim-common-7.4.629-8.el7_9.aarch64.rpm | 5.9 MB 00:00:01
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 3.6 MB/s | 19 MB 00:00:05
warning: /var/cache/yum/aarch64/7/base/packages/perl-HTTP-Tiny-0.033-3.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Importing GPG key 0x305D49D6:
Userid : "CentOS AltArch SIG - AArch64 (http://wiki.centos.org/SpecialInterestGroup/AltArch/AArch64) <security@centos.org>"
Fingerprint: ef8f 3ca6 6efd f32b 36cd adf7 6c7c b6ef 305d 49d6
Package : centos-release-7-9.2009.0.el7.centos.aarch64 (@instCentOS)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7-aarch64
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
/etc/pki/rpm-gpg/下的文件
[root@07ee0b946419 /]# ll /etc/pki/rpm-gpg/
total 16
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-7
-rw-r--r--. 1 root root 1065 Oct 23 2020 RPM-GPG-KEY-CentOS-7-aarch64
-rw-r--r--. 1 root root 1004 Oct 23 2020 RPM-GPG-KEY-CentOS-Debug-7
-rw-r--r--. 1 root root 1690 Oct 23 2020 RPM-GPG-KEY-CentOS-Testing-7
[root@07ee0b946419 /]#