there are two steps in switch docker to non root and mount with NFS. however, there are several knowns issues with the switch as well
- switch to non root
//in dockerfile
//add the group and user
RUN groupadd -g $GID <groupname> && useradd -lms /bin/bash -g $GID -u $UID <username>
//switch to non root
USER <username>
the group id and user is needed in order to mount the NFS or any existing directory for the existing user (the non root user). otherwise, it’s not needed if mount is not needed.
there is an issue with large group id and user id,
https://github.com/moby/moby/issues/5419
the solution is to disable the logging, which otherwise would explode the lastlog
and faillog
in docker, which took more than 200GB in our case for a super large user id (9 digit).
2. then to mount the NFS, if its existing directory, the file/folder permissions would copied over to the container (now with same user/group id)
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#user