mkdir -p WHERE_YOU_WANT_TO_PUT_THE_PREFIXdocker run --name build-gentoo -v WHERE_YOU_WANT_TO_PUT_THE_PREFIX:/root -it ubuntu:latestapt update
apt install -y curl build-essential git
export GENTOO_MIRRORS=http://mirrors.hust.edu.cn/gentoo
curl -L https://gitweb.gentoo.org/repo/proj/prefix.git/plain/scripts/bootstrap-prefix.sh | sed '2690,+10d' > build-gentoo.sh
./build-gentoo.shWhen running build-gentoo.sh, the script will ask some questions, you can just press enter to use the default value.
The script will take hours to finish, so you can just leave it there and do something else.
Quit the container and the prefix dir is WHERE_YOU_WANT_TO_PUT_THE_PREFIX/gentoo.
And you can set the environment $GENTOO_PREFIX_DIR and run setup script to setup the system.