Closed UlyssesWu closed 1 week ago
Hey @UlyssesWu,
We have created an internal ticket to look into this which we will be tracking as "GHC-283"
Hey @UlyssesWu
This is not an issue we have seen for a long time, assuming the node user in the container owns the folder everything should be working.
Can you share how you have n8n deployed?
If you have upgraded from an older version (before 1.0) check out the information here: https://docs.n8n.io/1-0-migration-checklist/#docker
The chown
was moved from the entrpoint into the Dockerfile here.
The assumption we make here is that when a user is mounting a directory into n8n container or using a volume, they are the ones responsible for making sure that n8n container has write permissions.
We don't want to do a chown
in the entrypoint because
root
user anymoreThanks for the explaination, that was quick.
I was trying to deploy n8n on my NAS. It's using its custom GUI for docker.
It did has the feature to mount directory with write permission. And it did work for many other docker images I have tried so far.
However it throws errors for the n8n image if I mount the /home/node/.n8n
directory. If I don't mount, it works fine.
Here is the screenshot for it's log:
(If I mount the directory with readonly permission, the error will be message: EROFS: read-only file system, open '/home/node/.n8n/config'
)
I also noticed someone else was saying this issue still happens: https://github.com/saltyorg/Sandbox/issues/301#issuecomment-1789743841
Now I consider it might be a fault on the NAS OS side. Thanks again.
To everyone who is using docker in NAS and facing the same problem, the workaround could be:
/home/node/n8n
(not .n8n
)cp -r /home/node/.n8n/* /home/node/n8n/
chown -R node /home/node/n8n
/home/node/n8n
to /home/node/.n8n
The problem is, if you mount /home/node/.n8n
at the beginning, the container will soon restart because of error and you won't have chance to execute commands like chown
.
Unfortunately, I encountered the same error on my Ubuntu host. See the docker-compose.yml
file for more configuration details: applicable to
When docker compose up -d
is successfully executed, I do get the following error message for n8n container:
(node:7) [EACCES] Warning: Error
module: @oclif/core@4.0.7
task: findCommand (license:clear)
plugin: n8n
root: /usr/local/lib/node_modules/n8n
code: EACCES
message: EACCES: permission denied, open '/home/node/.n8n/config'
See more details with DEBUG=*
> docker compose up -d
[+] Running 4/4
✔ Network n8n_n8n Created 0.1s
✔ Container redis-n8n Healthy 6.1s
✔ Container postgres-n8n Healthy 6.1s
✔ Container n8n Started
# This is with docker compose up -d
# /home/docker/n8n/n8n remains empty
> ls -ld /home/docker/n8n/{n8n,postgres_data,redis_data} /home/docker/n8n/
drwxr-xr-x 5 root root 4096 Oct 6 19:57 /home/docker/n8n/
drwxr-xr-x 2 root root 4096 Oct 6 19:57 /home/docker/n8n/n8n
drwx------ 19 70 root 4096 Oct 6 19:57 /home/docker/n8n/postgres_data
drwxr-xr-x 2 lxd root 4096 Oct 6 19:57 /home/docker/n8n/redis_data
# Tested and set `init-data.sh` with/without `chmod +x init-data.sh`
> ls -lah
total 24K
drwxrwxr-x 2 admin admin 4.0K Oct 6 20:26 .
drwxrwxr-x 42 admin admin 4.0K Oct 6 12:43 ..
-rw-rw-r-- 1 admin admin 3.1K Oct 6 20:20 docker-compose.yml
-rw-rw-r-- 1 admin admin 307 Oct 6 20:27 .env
-rwxrwxr-x 1 admin admin 500 Oct 6 14:46 init-data.sh
-rw-rw-r-- 1 admin admin 572 Oct 6 14:40 README.md
Do note: ${N8N_HOME}
== /home/docker/n8n
# docker-compose.yml
#
# https://github.com/n8n-io/n8n-hosting
## https://github.com/n8n-io/n8n-hosting/tree/main/docker-compose/withPostgresAndWorker
#
# Queue mode disabled for now. MVP and as simple as possible.
#
x-shared: &shared
# https://github.com/n8n-io/n8n/pkgs/container/n8n
# image: reg.<harbor>.com/ghcr.io/n8n-io/n8n:1.62.1
image: reg.<harbor>.com/ghcr.io/n8n-io/n8n:1.61.0
restart: unless-stopped
env_file:
- .env
environment:
# https://docs.n8n.io/hosting/configuration/environment-variables/#environment-variables-overview
- N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
- N8N_PORT=${N8N_PORT}
- N8N_PROTOCOL=http # HAProxy SSL offload
- NODE_ENV=production
- WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
- GENERIC_TIMEZONE=${TZ}
# - EXECUTIONS_MODE=queue # see https://docs.n8n.io/hosting/scaling/queue-mode/#queue-mode
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=${POSTGRES_PORT}
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_BULL_REDIS_PORT=${REDIS_PORT}
- QUEUE_HEALTH_CHECK_ACTIVE=true
links:
- postgres
- redis
volumes:
- "${N8N_HOME}/n8n:/home/node/.n8n"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
networks:
- n8n
services:
postgres:
# https://hub.docker.com/_/postgres/tags?page=1&name=alpine3.
image: reg.<harbor>.com/hub.docker.com/library/postgres:17.0-alpine3.20
container_name: postgres-n8n
# hostname: postgres-n8n
restart: unless-stopped
env_file:
- .env
ports:
- "${POSTGRES_PORT:-7432}:5432"
environment:
- POSTGRES_USER
- POSTGRES_PASSWORD
- POSTGRES_DB
- POSTGRES_NON_ROOT_USER
- POSTGRES_NON_ROOT_PASSWORD
volumes:
- "${N8N_HOME}/postgres_data:/var/lib/postgresql/data"
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}",
]
interval: 5s
timeout: 5s
retries: 10
networks:
- n8n
# https://docs.n8n.io/hosting/scaling/queue-mode/#start-redis
redis:
# https://hub.docker.com/_/redis/tags?name=alpine3.
image: reg.<harbor>.com/hub.docker.com/library/redis:7.4.0-alpine3.20
container_name: redis-n8n
# hostname: redis-n8n
restart: unless-stopped
env_file:
- .env
ports:
- ${REDIS_PORT}:6379
volumes:
- "${N8N_HOME}/redis_data:/data"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 10
networks:
- n8n
n8n:
<<: *shared
container_name: n8n
ports:
- 5678:5678
# # Worker and queue mode: https://docs.n8n.io/hosting/scaling/queue-mode/#queue-mode
# n8n-worker:
# <<: *shared
# command: worker
# depends_on:
# - n8n
networks:
n8n:
Bug Description
https://github.com/n8n-io/n8n/issues/1240
Same problem still happens on the latest version. I could not find the fix line in latest
docker/images/n8n/docker-entrypoint.sh
https://github.com/n8n-io/n8n/commit/4a98fe48a9fe86bc5b994b56e28cf3b226fbcbf8
To Reproduce
see https://github.com/n8n-io/n8n/issues/1240
Expected behavior
see https://github.com/n8n-io/n8n/issues/1240
Operating System
Linux (unknown version) with docker
n8n Version
1.61.0
Node.js Version
20.17.0
Database
SQLite (default)
Execution mode
main (default)