Screen_Recording_20240118_144445_Termux-ezgif.com-crop-video.mp4
Run Docker x86_64 on Arm computers or Android
Original idea: https://gist.github.com/oofnikj/e79aef095cd08756f7f26ed244355d62 and https://github.com/egandro/docker-qemu-arm
This is a automatic installation script. As memory is always short, we also install zram.
This repo works a little bit different than the others, I removed all "wget" from scripts and use "git clone" instead because it is more simple.
๐ My porpose is use it with proot-distro and arch linux on my Samsung Tab S9 Ultra, but can works with other distros too (and without proot-distro).
If you want run with "wget" I suggest you to use the original solution egandro/docker-qemu-arm. Just remember to update the alpine-virt version to the latest and use my answerfile to work properly with the newest alpine-virt versions.
(The old version works fine too, but you can't use docker compose because it's not included on repository of Alpine 3.14)
export PREFIX
line on config.env
./ubuntu-setup.sh
instead of ./termux-setup.sh
$ git clone https://github.com/antonyz89/docker-qemu-arm
$ cd docker-qemu-arm
$ ./termux-setup.sh
$ git clone https://github.com/antonyz89/docker-qemu-arm
$ cd docker-qemu-arm
$ ./pi-setup.sh
$ git clone https://github.com/antonyz89/docker-qemu-arm
$ cd docker-qemu-arm
$ ./fedora-arm-setup.sh
- enter on folder called "alpine"
- start the VM with "startqemu.sh"
- root passwort is "Secret123" but root in ssh is locked by password
- please change the password anyway
- you can ssh to the VM with a 2nd Terminal and "ssh2qemu.sh" qemukey / qemukey.ssh are SSH keys
- run a "uname -a" and a "docker run hello-world"
- now you can move (and rename) "alpine" folder and delete the
qemu-arm-arm
folder :D
Want use docker in your terminal without need enter on qemu machine? like:
# your terminal
cd your/project
docker compose up -d
# ...
Just follow these steps:
-
Download docker static binary
โ ๏ธ or just install docker directly (e.g.sudo pacman -S docker
)
- https://download.docker.com/linux/static/stable/aarch64/
- e.g.:
wget https://download.docker.com/linux/static/stable/aarch64/docker-24.0.7.tgz
- Extract it
tar -xvf docker-24.0.7.tgz
cd docker-24.0.7
sudo cp docker /usr/local/bin/
-
Add to your .bashrc/.zshrc/etc file:
-
eval $(ssh-agent) # Change `~/docker-qemu-arm/alpine/` to your actual folder ssh-add ~/docker-qemu-arm/alpine/qemukey export DOCKER_HOST=ssh://root@localhost:2222 # Change `~/docker-qemu-arm/alpine/` to your actual folder alias stq="cd ~/docker-qemu-arm/alpine && ./startqemu.sh && cd" alias sshq="cd ~/docker-qemu-arm/alpine && ./ssh2qemu.sh && cd"
-
Using fish shell? use it instead:
if test -z (pgrep ssh-agent | string collect) eval (ssh-agent -c) set -Ux SSH_AUTH_SOCK $SSH_AUTH_SOCK set -Ux SSH_AGENT_PID $SSH_AGENT_PID ssh-add /path/to/qemukey # e.g. ssh-add ~/alpine/qemukey end export DOCKER_HOST=ssh://root@localhost:2222
-
-
Save, open a new terminal and now run:
docker ps # result CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
If don't work, have sure that you have started qemu with
startqemu.sh
-
๐ It's done!
Obs: you can use docker outside of qemu, but yours containers will be running inside qemu.
Obs 2: need use docker compose? You can install it with sudo pacman -S docker-compose
or equivalent
- kubernetes (which is a very stupid idea): cgroups in Alpine must be configured properly
- just in case you really want that here is how: https://wiki.alpinelinux.org/wiki/Docker
- Thanks to everybody who made this happen.
- added config.env - this makes it much simpler for developers to tweak version numbers
- fixed issue with alpine for zram
- updated to alpine-virt-3.14.0-x86_64.iso
- updated README with steps to use docker outside of qemu (via ssh)
- updated to alpine-virt-3.19.0-aarch64.iso
- updated answerfile to works with 3.19.0
- using local files instead download all files with wget. Clone the repo, execute the script and delete the repo is more simple