The current n8n docker installation runs with PUID and PGID of 1000.
By doing this n8n runs on the system with the user 1000 is assigned.
For example in my installation environment 1000 id is the user mysql.
So n8n runs as mysql user.
The problem is when you create a folder or a volume and map this to docker and wants the n8n to write, edit and delete files and folders inside this parent folder, you have to chown the permissions for the parent folder to that of mysql user in my example.
The best thing is to create a user in linux for the n8n installation and assign that ID to the docker via environent variables.
So in docker compose will look something like that:
environment:
PUID=1002
PGID=1002
Please consider adding that option so we stop using others users permissions to folders and files so that n8n can write and modify files and folders locally in host.
It would be excellent to support this for sharing application data across NFS volumes. My specific use-case is that I have n8n deployed in a small k3s cluster and have set custom filesystem permissions for certain deployments and namespaces.
Most, if not all linuxserver.io containers implement this handy feature which makes deployment a lot more flexible!
is there any progress on this? i’m struggling with a docker install on Synology, specifically to mount and map a persistent volume to /home/node/.n8n, and the problem is entirely because i can’t set a custom PUID and PGID on the container.
Yes I did. In docker-compose your mapped volumes need ‘:rw’ at the end, so ‘/n8n:rw’ and ‘/files:rw’ and so on, and permissions need to be explicit. The Marius guide goes through this in points 13-16 and it’s correct, because n8n installs and tries to write as 1000:1000 and I’ve not yet found a docker-compose that can set custom PUID and GUIDs. Right click the n8n docker folder, then Permissions > Advanced options. Select ‘make inherited permissions explicit’,
then in User or Group list, select Everyone, click Edit
, then tick the box next to Write, then Done and save.
solved my problem where my cloud computing service has injected themselves as the default user 1000 with my user as 1001. i couldn’t stand combing my docker volumes and seeing my files not being owned by me!