# \[docker Course 5-11\] EACCESS permission denied

**URL:** <https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177>\
**Category:** Docker\
**Created:** [October 27, 2021, 2:30pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177 "2021-10-27T14:30:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![standm](https://avatars.discourse-cdn.com/v4/letter/s/57b2e6/32.png) [@standm](https://forum.codewithmosh.com/u/standm)\
**Post date:** [October 27, 2021, 2:30pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177/1 "2021-10-27T14:30:50Z")

</div>

Hello there ,

I’m working on WSL2 with an Ubuntu-20.04 distro

During this lesson, when mosh introduces the path to volumes with the $(pwd) path (1.58min) and I try to start a new container, if I look at the logs, it says the following:

> > react-app@0.1.0 start /app  
> > react-scripts start
> 
> ℹ ｢wds｣: Project is running at [http://172.17.0.6/](http://172.17.0.6/)  
> ℹ ｢wds｣: webpack output is served from  
> ℹ ｢wds｣: Content not from webpack is served from /app/public  
> ℹ ｢wds｣: 404s will fallback to /  
> Starting the development server…
> 
> Failed to compile.
> 
> EACCES: permission denied, open ‘/app/node\_modules/.cache/.eslintcache’

can anyone give me some pointers ?

After looking around for a bit, it seems to be a question of privilege access for the app user, but I’m still not very confortable with tinkering with that ^^

thanks a lot for your help, whoever you are !

Stan

---

<div class="post-metadata">

**Author:** ![wdburgdorf](https://avatars.discourse-cdn.com/v4/letter/w/839c29/32.png) [@wdburgdorf](https://forum.codewithmosh.com/u/wdburgdorf)\
**Post date:** [February 26, 2022, 5:28pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177/2 "2022-02-26T17:28:36Z")

</div>

Try adding this “somewhere”: chown -R app /app  
That should make the user “app” owner of the directory.  
I really wonder how this worked for Mosh and does not work for us. And why he does not care to fix it.

---

<div class="post-metadata">

**Author:** ![robertnking](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@robertnking](https://forum.codewithmosh.com/u/robertnking)\
**Post date:** [August 14, 2022, 4:18pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177/3 "2022-08-14T16:18:48Z")

</div>

> [@wdburgdorf](#):
>
> chown -R

@wdburgdorf @standm - Glad to see I’m not the only one with this issue. I’ve just gone through this course yesterday and today and am stumped on the permissions issue. Have either of you found a working solution?  
Thanks for your help!

---

<div class="post-metadata">

**Author:** ![sylvain\_FM](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sylvain\_FM](https://forum.codewithmosh.com/u/sylvain_FM)\
**Post date:** [December 8, 2022, 7:14pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177/5 "2022-12-08T19:14:39Z")

</div>

- If you have a pc: this link is enough:[6 Ways to fix - Got permission denied while trying to connect to the Docker daemon socket? | Jhooq](https://jhooq.com/permission-denied-docker-daemon/)  
to solve your issue, type in your command line : sudo usermod -aG docker $USER

- if you have a mac you’ll have:  
sudo: usermod: command not found

> <https://stackoverflow.com/questions/70369278/how-to-add-the-current-user-to-the-docker-group-on-macos>

For MacOS:

```nohighlight
sudo dscl . create /Groups/docker
sudo dseditgroup -o edit -a $USER -t user docker

```

BUT MAYBE WE HAVE A BAD INSTALLATION ? [Understand permission requirements for Mac | Docker Documentation](https://docs.docker.com/desktop/mac/permission-requirements/)

I’m sure now we forgot one step:  
**npm install** in the command line

because the docker build -t docker-app is working with this dockerfile: FROM node:current-alpine3.16

RUN addgroup app && adduser -S -G app app

FROM node:19.2-alpine

RUN addgroup app && adduser -S -G app app

WORKDIR /app

COPY . .

RUN npm install

ENV API\_URL=[http://api.myapp.com/](http://api.myapp.com/)

USER app

EXPOSE 3000

CMD [“npm”, “start”]

ENTRYPOINT [“npm”, “start”]

---

<div class="post-metadata">

**Author:** ![Oleh](https://avatars.discourse-cdn.com/v4/letter/o/b4bc9f/32.png) [@Oleh](https://forum.codewithmosh.com/u/Oleh)\
**Post date:** [August 27, 2023, 5:27pm UTC](https://forum.codewithmosh.com/t/docker-course-5-11-eaccess-permission-denied/8177/6 "2023-08-27T17:27:48Z")

</div>

Don’t think it is still needed for you but I will leave my **not ideal** solution here for felow future students of the Docker course.  
Ok, so what I managed to understand:

1. When we use volume created in advance and point it to app (container) user - then all is ok with permissions.
2. When we use absolute path (like `$(pwd):/app`) docker shares host files with container and as such - shares permissions, but not by user and group names, but by UID and GID. You can run `ls -ln` in your project path on host and see who is the owner ( usually it will be 1000 1000, if you have only one user created except for root, and this user is your main).  
And here is the thing, by having `$(pwd):/app`, in your container /app will also have UID and GID 1000 1000.  
At the same time `FROM node:14.16.1-alpine3.13` in Dockerfile creates user and group _node_ with the same ids.  
And as such owner of the shared /app directory and it’s contents is _node_ user. But in Dockerfile we set `USER app`, which isn’t owner of the shared node\_modules folder. And when we are trying to `npm start` - _app_ user doesn’t have needed permissions, from here:

> EACCESS permission denied

My **not ideal** 😉 solution:  
Add this lines after first (FROM …) line:

```auto
RUN apk -U add shadow
RUN groupmod -g 1001 node \
  && usermod -u 1001 -g 1001 node

```

They will change node user UID and GID to 1001. After that when creating app group it will be created with 1000 GID, which in turn will allow all users in app group have access to all shared files (if owner group of the shared files on a host has 1000 GID).

It’s not the best way to solve the problem, because if you share image to the different machine with host owner of the files 1002 - it won’t work without rebuildind.

Hope it would be helpfull for someone in the future.  
Bye 🤗
