x86架构服务器运行arm的镜像

x86架构服务器运行arm的镜像

注册qemu解释器

wget https://github.com/multiarch/qemu-user-static/releases/download/v5.1.0-2/qemu-aarch64-static.tar.gz
tar xf qemu-aarch64-static.tar.gz -C /usr/bin/
# 启动 qemu
docker run --rm --privileged multiarch/qemu-user-static:register

测试

docker run --rm -t -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static arm64v8/ubuntu:18.04 uname -m
# 正常输出 aarch64
docker run -it --rm -v $PWD:/tmp  -v /usr/bin/qemu-aarch64-static:/usr/bin/qemu-aarch64-static centos:7 bash