Prevent Docker from creating files as root on the host
October 24, 2021
The command below will run a Docker container using the host user and group ID, this way, files created on the host from the container through a volume will be accessible to the host user
docker run ... -u $(id -u):$(id -g) ...
Credits to btiernay