I got discourse to work when Docker started with --userrns-remap=default.
In my case docker allocated UID 100000 and GID 100000 to root within the discourse container.
To get bootstrap to succeed I needed to set group and ownership on the discourse shared directory correctly:
sudo chown -R 100000:100000 /var/discouse/shared
sudo chown 0711 /var/discouse/shared
It needs to be said that the recursive chown command should only be run once before first bootstrapping.