I have created a react app and trying to run it over the docker container with volumes (mapping content inside the container with outside files), everything was working fine earlier but now facing an issue as shared. Can anyone help me with that? This is a permission issue but doesn't know how to resolve that. root user has access of node_modules folder. How to give access to node user ?
My docker file
FROM node:alpine
USER node
WORKDIR '/home/node'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
Commands used:
docker build -t frontend -f Dockerfile.dev .
docker run -p 3000:3000 -v /home/node/node_modules -v $(pwd):/home/node frontend:latest
Access in container:
~ $ ls -l
total 1488
-rw-rw-r-- 1 node node 124 Jun 20 08:37 Dockerfile.dev
-rw-rw-r-- 1 node node 3369 Jun 17 18:25 README.md
drwxr-xr-x 3 node node 4096 Jun 17 18:45 build
-rw-rw-r-- 1 node node 230 Jun 20 06:56 docker-compose.yml
drwxrwxr-x 1041 root root 36864 Jun 20 19:15 node_modules
-rw-rw-r-- 1 node node 1457680 Jun 18 18:28 package-lock.json
-rw-rw-r-- 1 node node 811 Jun 17 18:26 package.json
drwxrwxr-x 2 node node 4096 Jun 17 18:25 public
drwxrwxr-x 2 node node 4096 Jun 17 18:25 src