./build.sh --sudo
is not meant to be run on the phone. It is nonsense to install Docker on Librem 5 and attempt to build there Android image. It would take week and you would need to use some external USB-C (3) SSD because required space is 60 GiB. The whole internal capacity of Librem 5 is 32 GiB and it holds system etc… The build has to be run on reasonably powerful PC with Docker capabilities, may it be there are some chances on Windows or in its WSL2, but I do not use Windows for years and colleagues reported that their filesystem is really significantly slower for regular projects (large Qt etc…) compilation. Your post motivated me to start image build, it runs already for three hours on older but powerful 4 core i7 system remotely to not block me on my laptop and other local sytems and it seized 40 Gigabytes of the disk already.
Edit:
It seems that my build attempt has stuck on
[ 34% 11964/34508] target R.java/Manifest.java: Calendar (out/target/common/obj/APPS/Calendar_intermediates/src/R.stamp)
packages/apps/Calendar/res/values-ar-rXB/arrays.xml:0: warning: Resource file packages/apps/Calendar/res/values-ar-rXB/arrays.xml is skipped as pseudolocalization was done automatically.
packages/apps/Calendar/res/values-ar-rXB/strings.xml:0: warning: Resource file packages/apps/Calendar/res/values-ar-rXB/strings.xml is skipped as pseudolocalization was done automatically.
Warning: AndroidManifest.xml already defines minSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
Warning: AndroidManifest.xml already defines targetSdkVersion (in http://schemas.android.com/apk/res/android); using existing value in manifest.
[ 34% 11971/34508] build out/target/common/obj/JAVA_LIBRARIES/sdk_v19_intermediates/classes.jack