Host Machine Info
- Host: Raspberry Pi 5 Model B Rev 1.0
- OS: Alpine Linux v3.19 aarch64
- CPU: (4) @ 2.400GHz
- Memory: 7946MiB
- Shell: fish 3.6.3
- Kernel: 6.6.14-0-rpi
Preparations
Pull Docker image
docker pull gentoo/stage3
Download stage3 image
# According to the current distribution
# "https://distfiles.gentoo.org/releases/arm64/autobuilds/"
wget https://distfiles.gentoo.org/releases/arm64/autobuilds/20240407T234908Z/stage3-arm64-openrc-20240407T234908Z.tar.xz
Unzip stage3 image
mkdir 04_Gentoo_in_Docker
cd 04_Gentoo_in_Docker
cp /path/to/stage3-*.tar.xz .
sudo tar xpvf stage3-*.tar.xz
Run Docker
docker run -it --name Gentoo --restart=always \
-v /home/oxalis/04_Gentoo_in_Docker/etc:/etc \
-v /home/oxalis/04_Gentoo_in_Docker/usr:/usr \
-v /home/oxalis/04_Gentoo_in_Docker/bin:/bin \
-v /home/oxalis/04_Gentoo_in_Docker/root:/root \
-v /home/oxalis/04_Gentoo_in_Docker/var:/var \
-v /home/oxalis/04_Gentoo_in_Docker/opt:/opt \
-v /home/oxalis/04_Gentoo_in_Docker/home:/home \
-v /home/oxalis/04_Gentoo_in_Docker/lib:/lib \
-v /home/oxalis/04_Gentoo_in_Docker/lib64:/lib64 \
-v /home/oxalis/04_Gentoo_in_Docker/mnt:/mnt \
-v /home/oxalis/04_Gentoo_in_Docker/media:/media \
-v /home/oxalis/04_Gentoo_in_Docker/boot:/boot \
-v /home/oxalis/04_Gentoo_in_Docker/sbin:/sbin \
-v /home/oxalis/04_Gentoo_in_Docker/sys:/sys \
-v /home/oxalis/04_Gentoo_in_Docker/tmp:/tmp \
-v /home/oxalis/04_Gentoo_in_Docker/run:/run \
-p 127.0.0.1:2222:22 \
-d gentoo/stage3
Enter Container
docker exec -it Gentoo /bin/bash
# Change root password
passwd
useradd <username> -m
passwd <username>
Enable SSH Service
ssh-keygen -A
exit
docker exec -it Gentoo /sbin/sshd
Enjoy!
ssh -p 2222 <username>@127.0.0.1