Bootstrap FreeKB - Docker - Resolve "EACCES permission denied"
Docker - Resolve "EACCES permission denied"

Updated:   |  Docker articles

Let's say the following error is being returned when attempting to create a NodeJS application on Docker.

Error: EACCES: permission denied, scandir '/app/work'

 

This typically occurs when using the docker run command to create and start a container with the -v or --volume option and means that the user that is attempting to create the /foo directory in the container does not have permission to the /usr/local/docker/foo directory on the Docker system.

docker run --volume /usr/local/docker/foo:/foo nodejsfooapp

 

By default, directories on a Linux system will have 0775 or drwxrwxr-x permssion and will be owned by the user that created the directory. In this example, root has read/write/execute permission, and every other user has read and execute, but not write permission.

[root@lab1 ~]# ls -ld /usr/local/docker/foo
drwxr-xr-x 2 root root 6 Sep 27 02:40 /usr/local/docker/foo

 

One option is to update the directory on the Docker system to have 0777 or drwxrwxrwx permssion, so that all users have read/write/execute permission.

chmod 0777 /usr/local/docker/foo

 

Another option, and typically the preferred option, is to determine the user that is attempting to create the /foo directory in the container. Let's say the user is john.doe. In this example, you would create the john.doe user on the Docker system.

useradd john.doe

 

And then update the /usr/local/docker/foo directory on the Docker system to be owned by john.doe.

chown john.doe /usr/local/docker/foo
chgrp john.doe /usr/local/docker/foo

 

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e9c579 in the box below so that we can be sure you are a human.