2024-01-05-x86 架構(gòu)運行 其他架構(gòu)鏡像

初始環(huán)境
系統(tǒng): centos 7 ( x86\_64 GNU/Linux) docker版本 :Docker version 20.10.08
binfmt_misc 、QEMU依賴安裝
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
驗證qemu是否安裝成功
[root@VM-187-115-centos ~]# ls  /proc/sys/fs/binfmt_misc/ 
kshcomp          qemu-arm      qemu-m68k          qemu-mips64    qemu-mipsn32el  qemu-ppc64le  qemu-sh4          qemu-sparc64   status
qemu-aarch64     qemu-armeb    qemu-microblaze    qemu-mips64el  qemu-or1k       qemu-riscv32  qemu-sh4eb        qemu-xtensa
qemu-aarch64_be  qemu-hexagon  qemu-microblazeel  qemu-mipsel    qemu-ppc        qemu-riscv64  qemu-sparc        qemu-xtensaeb
qemu-alpha       qemu-hppa     qemu-mips          qemu-mipsn32   qemu-ppc64      qemu-s390x    qemu-sparc32plus  register
可以看到qemu支持的架構(gòu)有 arm、mips ,qemu-mips64el的狀態(tài)是 enabled
[root@VM-187-115-centos ~]# cat /proc/sys/fs/binfmt_misc/qemu-mips64el
enabled
interpreter /usr/bin/qemu-mips64el-static
flags: F
offset 0
magic 7f454c4602010100000000000000000002000800
mask ffffffffffffff00fffffffffffffffffeffffff
測試
[root@VM-187-115-centos ~]# docker pull loongsongd/debian_mips64el_x64:v9
v9: Pulling from loongsongd/debian_mips64el_x64
46118084dfd4: Pull complete 
Digest: sha256:1356718d3a359d66cfa2b4560d64f57eaa0f3b3963d918d5c0ee23674018134a
Status: Downloaded newer image for loongsongd/debian_mips64el_x64:v9
docker.io/loongsongd/debian_mips64el_x64:v9
[root@VM-187-115-centos ~]# docker images
REPOSITORY                       TAG       IMAGE ID       CREATED        SIZE
loongsongd/debian_mips64el_x64   v9        f807eae237d5   6 days ago     267MB
multiarch/qemu-user-static       latest    871019ea8dda   3 months ago   299MB
[root@VM-187-115-centos ~]# docker run -it loongsongd/debian_mips64el_x64:v9 /bin/bash
root@620f1c5e8616:/# uname -a
Linux 620f1c5e8616 5.4.119-1-tlinux4-0008 #1 SMP Fri Nov 26 11:17:45 CST 2021 mips64 GNU/Linux
loongarch 架構(gòu)的支持
[root@VM-187-115-centos /data/workspace]# wget https://gitee.com/michael0066/qemu-loongarch64-static/blob/master/qemu-loongarch64-static -P /usr/bin/qemu-loongarch64-static && chmod 755 qemu-loongarch64-static
注冊 loongarch
[root@VM-187-115-centos /data/workspace]# echo ":qemu-loongarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02\x01:\xff\xff\xff\xff\xff\xfe\xfe\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-loongarch64-static:" > /proc/sys/fs/binfmt_misc/register

//  檢查是否注冊成功
[root@VM-187-115-centos /data/workspace]# ls  /proc/sys/fs/binfmt_misc/ |grep loonqemu-loongarch64
qemu-loongarch64
下載loongarch 鏡像,確認(rèn)是否可以運行
# docker pull loongsongd/debian10_loongarch64_x64:e15.0
[root@VM-187-115-centos /data/workspace]# docker images
REPOSITORY                                               TAG           IMAGE ID       CREATED        SIZE
loongsongd/debian_mips64el_x64                           v9            f807eae237d5   6 days ago     267MB
mirrors.tencent.com/wwlocal4ubuntu/ubuntu_arm_compiler   tag20220215   5fe79aae8948   2 weeks ago    3.67GB
loongsongd/debian10_loongarch64_x64                      e15.0         6e04cd1bee86   2 months ago   2.91GB
multiarch/qemu-user-static                               latest        871019ea8dda   3 months ago   299MB
[root@VM-187-115-centos /data/workspace]# docker run -it loongsongd/debian10_loongarch64_x64:e15.0 /bin/bash
root@44adb0d84b94:/# uname -a
Linux 44adb0d84b94 5.16.0 #1 SMP Fri Nov 26 11:17:45 CST 2021 loongarch64 loongarch64 loongarch64 GNU/Linux
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容