lake@localhost:~$ ~/usr/bin/qemu-arm -version
qemu-arm version 4.2.0
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
lake@localhost:~$
lake@localhost:~$ uname -a
Linux ShSwDev2 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
lake@localhost:~$
lake@localhost:~$ docker version
Client:
Version: 18.06.1-ce
API version: 1.38
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:24:56 2018
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.1-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: e68fc7a
Built: Tue Aug 21 17:23:21 2018
OS/Arch: linux/amd64
Experimental: false
lake@localhost:~$
### default binfmt_misc
lake@localhost:~/local/lfs/ubuntu-base-18.04-base-armhf$ ls -l /proc/sys/fs/binfmt_misc/
total 0
-rw-r--r-- 1 root root 0 Jan 9 22:01 cli
-rw-r--r-- 1 root root 0 Jan 9 22:01 jar
-rw-r--r-- 1 root root 0 Jan 9 22:01 jarwrapper
-rw-r--r-- 1 root root 0 Jan 9 22:01 llvm-3.8-runtime.binfmt
-rw-r--r-- 1 root root 0 Jan 9 22:01 python2.7
-rw-r--r-- 1 root root 0 Jan 9 22:01 python3.5
--w------- 1 root root 0 Jan 9 22:01 register
-rw-r--r-- 1 root root 0 Jan 9 22:01 status
## Download busybox ARM docker image
### note this is linux/arm/v7 busybox
##
https://hub.docker.com/layers/busybox/library/busybox/latest/images/sha256-7044f6fc222ac87449d87e041eae6b5254012a8b4cbbc35e5b317ac61aa12557
$ docker pull busybox@sha256:7044f6fc222ac87449d87e041eae6b5254012a8b4cbbc35e5b317ac61aa12557
lake@localhost:~/local/lfs/ubuntu-base-18.04-base-armhf$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox <none> 5186b901b1f7 5 weeks ago 953kB
lake@localhost:~$ docker image ls |grep busybox
busybox <none> 5186b901b1f7 5 weeks ago 953kB
lake@localhost:~$
lake@localhost:~/local/lfs/ubuntu-base-18.04-base-armhf$ sudo /bin/bash
[sudo] password for jhula:
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# ls -l /proc/sys/fs/binfmt_misc/
total 0
-rw-r--r-- 1 root root 0 Jan 9 22:01 cli
-rw-r--r-- 1 root root 0 Jan 9 22:01 jar
-rw-r--r-- 1 root root 0 Jan 9 22:01 jarwrapper
-rw-r--r-- 1 root root 0 Jan 9 22:01 llvm-3.8-runtime.binfmt
-rw-r--r-- 1 root root 0 Jan 9 22:01 python2.7
-rw-r--r-- 1 root root 0 Jan 9 22:01 python3.5
--w------- 1 root root 0 Jan 9 22:01 register
-rw-r--r-- 1 root root 0 Jan 9 22:01 status
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# echo ":qemu-aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-aarch64:" >/proc/sys/fs/binfmt_misc/register
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# ls -l /proc/sys/fs/binfmt_misc/ total 0
-rw-r--r-- 1 root root 0 Jan 9 22:01 cli
-rw-r--r-- 1 root root 0 Jan 9 22:01 jar
-rw-r--r-- 1 root root 0 Jan 9 22:01 jarwrapper
-rw-r--r-- 1 root root 0 Jan 9 22:01 llvm-3.8-runtime.binfmt
-rw-r--r-- 1 root root 0 Jan 9 22:01 python2.7
-rw-r--r-- 1 root root 0 Jan 9 22:01 python3.5
-rw-r--r-- 1 root root 0 Jan 10 00:36 qemu-aarch64
--w------- 1 root root 0 Jan 10 00:36 register
-rw-r--r-- 1 root root 0 Jan 9 22:01 status
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# exit
lake@localhost:~/local/lfs/ubuntu-base-18.04-base-armhf$ docker run -v $HOME/usr/bin/qemu-aarch64:/usr/bin/qemu-aarch64 5186b901b1f7 /bin/bash
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
### Note busybox is for arm/v7, need qemu-arm static "
lake@localhost:~/local/lfs/ubuntu-base-18.04-base-armhf$ sudo /bin/bash
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:' >/proc/sys/fs/binfmt_misc/register
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# ls -l /proc/sys/fs/binfmt_misc/
total 0
-rw-r--r-- 1 root root 0 Jan 10 00:37 arm =======> /usr/bin/qemu-arm
-rw-r--r-- 1 root root 0 Jan 9 22:01 cli
-rw-r--r-- 1 root root 0 Jan 9 22:01 jar
-rw-r--r-- 1 root root 0 Jan 9 22:01 jarwrapper
-rw-r--r-- 1 root root 0 Jan 9 22:01 llvm-3.8-runtime.binfmt
-rw-r--r-- 1 root root 0 Jan 9 22:01 python2.7
-rw-r--r-- 1 root root 0 Jan 9 22:01 python3.5
-rw-r--r-- 1 root root 0 Jan 10 00:36 qemu-aarch64
--w------- 1 root root 0 Jan 10 00:37 register
-rw-r--r-- 1 root root 0 Jan 9 22:01 status
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf#
#### map local $HOME/usr/bin/qemu-arm to busybox rootfs /usr/bin/qemu-arm
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# docker run -itd --privileged -v ~/usr/bin/qemu-arm:/usr/bin/qemu-arm busybox@sha256:7044f6fc222ac87449d87e041eae6b5254012a8b4cbbc35e5b317ac61aa12557 /bin/sh
4366c97bb176e750caa3a2866b2c5b3a7534bd4ddff3aeac4e29a4909c1f8788
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf#
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4366c97bb176 busybox "/bin/sh" 26 seconds ago Up 25 seconds eager_kalam
root@ShSwDev2:/localrepo/jhula/lfs/ubuntu-base-18.04-base-armhf#
lake@localhost:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
4366c97bb176 busybox "/bin/sh" 31 minutes ago Up 31 minutes eager_kalam
################# get inside container of busybox/ARM
lake@localhost:~$ docker exec -it 4366c97bb176 /bin/sh
/ # ls /
bin dev etc home proc root sys tmp usr var
/ # uname -a
Linux 4366c97bb176 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 armv7l GNU/Linux
/ #