Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker install error: EACCES: permission denied, open '/home/node/.n8n/config' #1240

Closed
sutidor opened this issue Dec 9, 2020 · 10 comments
Closed

Comments

@sutidor
Copy link

sutidor commented Dec 9, 2020

Describe the bug
Error when using -v parameter:

docker run -it --rm \
>     --name n8n \
>     -p 5678:5678 \
>     -v ~/.n8n:/home/node/.n8n \
>     n8nio/n8n
UserSettings got generated and saved to: /home/node/.n8n/config
(node:7) UnhandledPromiseRejectionWarning: Error: There was an error: EACCES: permission denied, open '/home/node/.n8n/config' 

To Reproduce
Steps to reproduce the behavior:

  1. docker run command as in docs

Expected behavior
installation successful

Environment (please complete the following information):

  • OS: Docker version 19.03.13, build 4484c46d9d
  • n8n Version: n8nio/n8n

Additional context
If I run without the -v volume parameter it works. I read that it might be solved using RUN npm config set unsafe-perm true

@sutidor
Copy link
Author

sutidor commented Dec 9, 2020

Update:

Additional information: I am running on Debian 10 V-Server.
#1233 seems to address the issue (although about RPi) and it might be resolved at the same time.
It is related to the "node" user being used by default and not root. The directory is not chowned correctly during the installation process.

Quick fix

I use a volume, say n8n_data. I create it, and chown 1000:1000 the /n8n_data/_data directory, then run the docker run command again. Same works if you use a directory ~/.n8n I guess.

@janober
Copy link
Member

janober commented Dec 9, 2020

Very strange. Sounds like the user is not allowed to write to the file. You can try if opening the rights with the following command solves the issues:

chmod 777 -R ~/.n8n

@pointia
Copy link

pointia commented Dec 9, 2020

Update:

Additional information: I am running on Debian 10 V-Server.
#1233 seems to address the issue (although about RPi) and it might be resolved at the same time.
It is related to the "node" user being used by default and not root. The directory is not chowned correctly during the installation process.

Quick fix

I use a volume, say n8n_data. I create it, and chown 1000:1000 the /n8n_data/_data directory, then run the docker run command again. Same works if you use a directory ~/.n8n I guess.

I have the same problem because the home folder will be created by root. So here is the complete explanation of what to execute:

docker volume create n8n_data


 docker run -it --rm \
        --name n8n \
        -p 5678:5678 \
        -v n8n_data:/home/node/.n8n \
        n8nio/n8n


docker run -it --rm -v n8n_data:/home/data bash chown 1000:100 -R home/data


 docker run -it --rm \
        --name n8n \
        -p 5678:5678 \
        -v n8n_data:/home/node/.n8n \
        n8nio/n8n

@pointia
Copy link

pointia commented Dec 9, 2020

Update:

Additional information: I am running on Debian 10 V-Server.
#1233 seems to address the issue (although about RPi) and it might be resolved at the same time.
It is related to the "node" user being used by default and not root. The directory is not chowned correctly during the installation process.

Quick fix

I use a volume, say n8n_data. I create it, and chown 1000:1000 the /n8n_data/_data directory, then run the docker run command again. Same works if you use a directory ~/.n8n I guess.

So what you did is basically the following (which I did to get it up running).

docker volume create n8n_data

docker run -it --rm -v n8n_data:/home/data bash chown 1000:1000 -R /home/data

docker run -it --rm \
        --name n8n \
        -p 5678:5678 \
        -v n8n_data:/home/node/.n8n \
        n8nio/n8n

@sutidor
Copy link
Author

sutidor commented Dec 9, 2020

Exactly.

You can do it without the docker part, too:
chown -R 1000:1000 /var/lib/docker/volumes/n8n_data/_data

(careful: you got a typo chown 1000:100 <- )

@lupa18
Copy link
Contributor

lupa18 commented Dec 9, 2020

Hello, I have same problem here. I'm confused because there are 3 folders and 2 users involved here:
/data <- belongs to root declared at Dockerfile
/root/.n8n <- belongs to root used at docker-entrypoint-sh
/home/node <- belong to node used at docker-entrypoint-sh

So I re created the images, adding this line (after line 8) to docker/images/n8n/docker-entrypoint.sh

chown -R node /home/node

and now it works

tell me if you accept a PR

@ml-table
Copy link

Same here... restarting container..

@janober
Copy link
Member

janober commented Dec 19, 2020

Thanks a lot everybody!

Ah, interesting /home/node is not by default owned by "node"? Very strange. Yes, if that solves the issue and does not break anything for existing users a PR would be more than welcome!

lupa18 added a commit to TEDICpy/n8n that referenced this issue Dec 19, 2020
janober pushed a commit that referenced this issue Dec 19, 2020
@janober
Copy link
Member

janober commented Dec 19, 2020

Thanks a lot @lupa18 for the PR!

Got merged. The next n8n version will be released with the updated image.

@janober janober closed this as completed Dec 19, 2020
@janober
Copy link
Member

janober commented Dec 24, 2020

Got released with n8n@0.99.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@lupa18 @pointia @janober @sutidor @ml-table and others