Sharing the source code with container

EACCES: permission denied, open ‘/app/node_modules/.cache/.eslintcache’

I’m on Ubuntu machine. I’am having trouble running the react app when using code sharing command:

Here is the error in the browser window.
Failed to compile

EACCES: permission denied, open ‘/app/node_modules/.cache/.eslintcache’

Here are the commands I used:
salad@99:/$ docker image build -t react_image:1.0.0 .

salad@99:/ docker run -d -p 2066:3000 -v (pwd):/app --name c10 react_img:1.0.0

salad@99:/$ docker exec -it c10 sh

/app $ ls -l

total 1200
-rw-rw-r--    1 node     node           271 Apr 15 11:46 Dockerfile
-rw-r--r--    1 node     node            29 Apr 15 05:56
drwxrwxr-x 1061 node     node         36864 Apr 14 05:19 node_modules
-rw-rw-r--    1 node     node        657982 Apr 14 05:19 package-lock.json
-rw-r--r--    1 node     node           813 Mar  5 19:00 package.json
drwxr-xr-x    2 node     node          4096 Mar  9 16:27 public
-rw-rw-r--    1 node     node            12 Apr 15 10:02 secret.txt
drwxr-xr-x    2 node     node          4096 Mar  9 16:27 src
-rw-r--r--    1 node     node        507430 Mar  5 19:00 yarn.lock
/app $ 

The source of the problem seems to be the changing user to node instead of user.
I’ve my Dockerfile exact as Mosh’s. What could be the fix?

1 Like

I had the same on Ubuntu. Switching the user to node worked for me.

So the two last lines of the dockerfile shoud look like :

USER node

CMD ["npm", "start"]

Yeap, everything works well with the DEFAULT user “node”. You don’t even have to set explicitly

I don’t understand properly why we need to switch the app user to node can you please explain it better??

I wanted to give a link of an edited reply to my previous post, but it seems the platform does not allow to editing. Anyways I don’t how the default user “node” is generated but if you want to got by “node” user and figure out the problem later, ignoring user creation is the solution.

FROM node:14.16.0-alpine3.13
RUN mkdir app

It’s the default user. You can ignore user creation altogether

hey can you give me the zip file of the second last section of the docker course that is the sample web application that contains a backend and frontend and docker-compose file my email address please send me this project zip I can’t able to download this zip