a repository to help you use Docker in Termux with the "CaraKernel" kernel
-
CaraKernel Support (I just tested it on device #Ginkgo)
-
Recovery (Recommended OrangeFox)
-
Module CaraKernel (necessary to work!)
-
Magisk/ROOT (v23+)
-
Some #Notes that are worth reading.
- First I rooted my Xiaomi Redmi Note 8. Then I installed PixelOS Android 13.
- Install Termux. Then execute Moby’s script to check kernel’s compatibility o running docker.
pkg in wget tsu -y
wget https://raw.githubusercontent.com/moby/moby/master/contrib/check-config.sh
chmod +x check-config.sh
sed -i '1s_.*_#!/data/data/com.termux/files/usr/bin/bash_' check-config.sh
sudo ./check-config.sh
- The missing configs will be displayed. Take notes of these red missing configs (especially configs under Generally Necessary), we have to enable them during kernel compliation.
This step would be the compilation of the kernel. but not necessarily if your kernel already has the parameters enabled (good luck)
- Before changing kernels, backup dtbo and boot
- Download CaraKernel (for ginkgo)
- Flash the ZIP to your #RECOVERY
- Flash the #MAGISK MANDATORY!
if it stays in bootloop, boot into recovery and restore the backup you made earlier.
Running Docker containers
A message “There is an internal problem with your device” will pop up on every boot. Just ignore it.
- Open Termux, mount cgroups:
sudo mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
- Enable binfmt_misc:
su
mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
echo 1 > /proc/sys/fs/binfmt_misc/status
- Execute Moby’s script again: sudo ./check-config.sh. Make sure everything turns green.
Don't worry if it says: "CONFIG_PID_NS: missing, CONFIG_IPC_NS: missing, CONFIG_CGROUP_DEVICE: missing"
get docker /// Read here the reason that I put docker in another repository
sudo dockerd --iptables=false
This is the default netwok driver. If you don't specify a driver, this is the type of network you are creating. Bridge networks isolate the container network by editing the iptables rules and creating a network interface called Docker0 that serves as a bridge. All containers created with the bridge driver will use this interface. This is analogous to creating a VLAN and running the containers inside it.
But, there's a catch in Android: iptables rules policy is different here than on a conventional GNU/Linux system (more info here). For the bridge driver to work, you'll have to manually edit the iptable by running;
sudo ip route add default via 192.168.1.1 dev wlan0
sudo ip rule add from all lookup main pref 30000
Note: change 192.168.1.1 according to your gateway IP.
Unfortunately, this means that changing networks will require you to re-configure the rules again.
sudo docker run -it ubuntu bash
“Maybe you're wondering why the "apt update" command doesn't work”, yes, I let it go unnoticed, because I want to show you how to fix it:
sudo docker run -ti \
--net="host" \
--dns="8.8.8.8" \
ubuntu
running this way, the apt command will work normally.
ps: Don't forget to remove the container we created earlier
sudo docker ps -a
sudo docker rm <container_id>
- Attention, the current version
Docker version v23.0.1, build
of docker in termux doesn't work correctly. so i compiledDocker version v20.10.23-ce, build
- Note: it is no longer necessary to use that version mentioned above. apparently they fixed the bugs that there were and now you can download directly from termux. the last version I just tested is
v1:20.10.24-ce, build
-
this method was tested on Ginkgo using a PixelOS Android 13 custom rom.
-
don't ask me if it works for other types of kernels, I don't know.
-
the kernels I tested and not tested:
- HoriKernel
[work pass]
(My Kernel) - CaraKernel Kernel
[work pass]
- Cryo Kernel
[test fail]
- ElasticsPerf Kernel
[not booted]
- Meow Kernel
[test fail]
- LightNing Kernel
[test fail]
- Ryzen Kernel
[idk]
- Syxteen Kernel
[idk lol]
- QuickSilve Kernel
[idk, probably fail]
- HoriKernel
thanks to Freedie Oliveira for providing an efficient method and also docker-materia
if you think my work is cool or want to help me, make a small donation <3
bc1qluadws0x8822urvhdufdeft4rs0ay290drlkpu