십자 Docker를 실행하려면 qemu를 복사할 필요가 없습니다.

교차 Docker를 실행하려면 docker image에서 복사해야 합니다/usr/bin/qemu-aarch64-static.
https://embedded.hatenadiary.org/entry/20140820/p1
근데 이제 그거 필요 없어.

새로운 VM으로 실험 수행


이 기사의 VM을 사용하고 있습니다.
https://zenn.dev/tetsu_koba/articles/b2489355a7dec0
ubuntu@u01:~$ docker run -it arm64v8/ubuntu:20.04
Unable to find image 'arm64v8/ubuntu:20.04' locally
20.04: Pulling from arm64v8/ubuntu
d4ba87bb7858: Pull complete 
Digest: sha256:ca83774d06420ceb4682ef73bd9cbbfc38a97a27e061b578547a6761206658b9
Status: Downloaded newer image for arm64v8/ubuntu:20.04
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
다시 한 번 시도해 보세요.
ubuntu@u01:~$ docker run -it arm64v8/ubuntu:20.04
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
안 돼요.
설치qemu-user-static.
ubuntu@u01:~$ sudo apt install qemu-user-static
ubuntu@u01:~$ cat /proc/sys/fs/binfmt_misc/qemu-aarch64 
enabled
interpreter /usr/bin/qemu-aarch64-static
flags: OCF
offset 0
magic 7f454c460201010000000000000000000200b700
mask ffffffffffffff00fffffffffffffffffeffffff
ubuntu@u01:~$ ls -l /usr/bin/qemu-aarch64-static 
-rwxr-xr-x 1 root root 6638096 Feb 23 02:44 /usr/bin/qemu-aarch64-static
이제 한 번 더 도전한다.
ubuntu@u01:~$ docker run -it arm64v8/ubuntu:20.04
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
root@828bba0296b3:/#
이번에 시동이 걸렸어요.
root@828bba0296b3:/# uname -a
Linux 828bba0296b3 5.4.0-109-generic #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
root@828bba0296b3:/# 
다른 tty에서 다음 동작을 수행합니다
통과
ubuntu@u01:~$ ps ax |grep [q]emu
  14477 pts/0    Ssl+   0:00 /usr/bin/qemu-aarch64-static /usr/bin/bash
/usr/bin/qemu-aarch64-static집행/usr/bin/bash.

binfmt_misc


https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
F - fix binary
The usual behaviour of binfmt_misc is to spawn the binary lazily when the misc format file is invoked. However, this doesn’t work very well in the face of mount namespaces and changeroots, so the F mode opens the binary as soon as the emulation is installed and uses the opened image to spawn the emulator, meaning it is always available once installed, regardless of how the environment changes.
설치할 때interpreter를 열고 준비하기 때문에chroot에 걸려도 괜찮습니다.언제부터 이렇게 됐죠?참고로 이번 내핵 판본은 아래와 같다.
ubuntu@u01:~$ cat /proc/version
Linux version 5.4.0-109-generic (buildd@ubuntu) (gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)) #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022

연관성


arm64 Linux로 모모 강제 구축

좋은 웹페이지 즐겨찾기