Docker mounts files as uid 1001
Ideally dont run docker as superuser(root). You should create a user within dockerfile and chown the file system with that user. You can create a user and then add access to that user on the file system. In the below example there is appuser , with ownership to src
FROM ubuntu:latest
RUN useradd -r -u 1001 -g appuser appuser
RUN chown -R appuser.appuser /src
USER appuser
CMD [&quot;appuser&quot;, &quot;/src/index.js&quot;] 

Its not recommended to run as root
You could also run as any user (Say root id = 0) if needed from externally
docker run -d --user 0 ubuntu:latest

You should never relay on gid/uid  of the linux user outside the container.