-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup-chroot.sh
More file actions
42 lines (32 loc) · 1.36 KB
/
Copy pathsetup-chroot.sh
File metadata and controls
42 lines (32 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/system/bin/sh
#
# Docker on Android Chroot Setup Script
# Author: shitodcy
#
echo "Docker on Android - Alpine Chroot Setup"
echo "Author: shitodcy"
if [ "$(id -u)" != "0" ]; then
echo "[!] This script must be run as ROOT (su)!"
exit 1
fi
CHROOT_DIR="/data/alpine-docker"
echo "[*] Created chroot directory in $CHROOT_DIR..."
mkdir -p $CHROOT_DIR
echo "[*] Downloading Alpine Linux Mini RootFS (aarch64)..."
curl -Lo /data/alpine-minirootfs.tar.gz https://dl-cdn.alpinelinux.org/alpine/v3.19/releases/aarch64/alpine-minirootfs-3.19.1-aarch64.tar.gz
echo "[*] Extracting RootFS..."
tar -xf /data/alpine-minirootfs.tar.gz -C $CHROOT_DIR
rm /data/alpine-minirootfs.tar.gz
echo "[*] DNS configuration (resolv.conf)..."
echo "nameserver 8.8.8.8" > $CHROOT_DIR/etc/resolv.conf
echo "nameserver 1.1.1.1" >> $CHROOT_DIR/etc/resolv.conf
echo "[*] Performing initial mount..."
mount -o bind $CHROOT_DIR $CHROOT_DIR
mount -t proc proc $CHROOT_DIR/proc
mount -t sysfs sys $CHROOT_DIR/sys
mount -o bind /dev $CHROOT_DIR/dev
mount -t tmpfs tmpfs $CHROOT_DIR/run
echo "[*] Installing Docker, crun, iptables, and socat in chroot..."
chroot $CHROOT_DIR /bin/sh -c "export PATH=/bin:/usr/bin:/sbin:/usr/sbin:\$PATH && apk update && apk add docker iptables crun socat"
echo "[*] Installation complete!"
echo "Please use start-docker.sh to start the Docker daemon every time the device is rebooted."