I have an interesting problem with node, docker-compose and local development using bind mounts.
I have a bind mount volume, called www-public, owned by my host node user (I created a node user and chowned the dir to node:node). The container (official node) is set up so it also run as node user. At some point in my node app, i need to write to this folder and i get the permission error. This seems strange at first, but it makes sense, because i figured then, that my host nodeuser has an uid of 1001 while my container node user has an id of 1000. If i just add this line to my Dockerfile:
RUN usermod -u 1001 node && groupmod -g 1001 node
The permission problem goes away.
How do i fix this in a way, that I don't hard code the container node user id to match the node user id on the host like i did with the upper RUN command.