**Running n8n via Docker, npm, n8n cloud, desktop app): Docker
**Operating system: Ubuntu 20.04
I am new to n8n and i am now struggling with the write to disk step.
I am checking now since several ours and trying different solutions from google, the n8n community and so on, but nothing is working.
My last docker-compose file for the n8n volumes is
This is more or less the original docker-compose file from n8n github.
I changed the volume as mentioned in several posts to /home/rauscher/n8n/files:/files where the left side is exsiting on my linux server and the right side should be generated by the docker compose up.
after a check inside my docker the directory was created successfull, but i still get the error in the workflow
I dont know what i can change the only thing i can find is that the directory files which is created inside the docker has 1002:1002 user and not node:node.
If i try to write a file into the /home/node directory of the docker container, then its working, but this folder is not able to link to the root system.
If you are running docker with the node user you should map the volumes to a directory that node user has access to.
In your case you are running the container with user node but you have mapped the volume to the home directory of user rauscher so naturally you get access permissions.
It’s not like you can’t give node permissions to write somewhere in /home/rauscher/ like it was suggested but mixing user directories is a very bad practice and leads to chaos quickly.
A good practice is to create a directory for your persistent docker volumes and organize them by container/app
For example:
/opt/docker/n8n/
/opt/docker/postgres/
/opt/docker/qdrant/
Just make sure to create the sub-directory with the docker container user or change it’s owner with the chown command
I had same problem on window and docker.
I was using path /poetry.txt and it did not work, but when I changed it to ./poetry.txt it did. The relative folder dot in front did all the jazz for me.
Hope it helps.
edit:
Found also alternative approach.
Instead of writing to /home/node/.n8n (which is mounted and read-only from inside the container), we’ll use a new volume path, such as /data, which you control and mount from your Windows filesystem.
in docker compose:
volumes:
- ./storage:/home/node/.n8n
- ./output:/data # 👈 New volume for saving files
created the file in root system and ran with /data/poetry.txt which also worked for me.