Read/write local files

Describe the problem/error/question

I want to read and write local files with the “Read/Write files from Disk” node. The directory in which I want to save or read the files is “/Volumes/SSD drive/Docker/n8n”.
I am using a self-hosted version on my QNAP-NAS, created with docker-compose. I’ve already made the entry in docker-compose.yml according to the documentation.
The node is also executed successfully, but no data is read or written.

Information on your n8n setup

  • n8n version: 1.53.2
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: MacOS 14.5

Hi @Herby

Thanks for posting here and welcome to the community! :partying_face:

You can check if you have the right directory in your Disk node with the Execute Command node (pwd command)
How did you map that volume in your docker-compose?

Also, are you specifying the file name in the path? (e.g. “*.txt” for reading a file)

You can share your workflow here by pasting them as JSON in between two block quotes (```).

Hi @ria ,
if I just enter pwd in the execute node, the output is “/home/node”.

The directory I want to read/write is “/Volumes/SSD Laufwerk/Downloads”.
According the documentation

  • /home//n8n-local-files:/files

I added

  • /Volumes/SSD Laufwerk/Downloads:/files

in the docker-compose.yml at services/n8n/volumes.

Hey @Herby,

It could be that the container doesn’t have permissions but as you setting the path for your share to /files in the container I would access the container itself and browse to that path and see if you can touch a file or from inside n8n with an execute command node touch /files/test.txt to see if it makes the file or returns a permission error.

Hi @Jon,

I tried touch /files/test.txt and received a error permission denied.

Best regards
Herby

There is no information in the documentation that the folder in the container must exist. I created the folder files, now I can write text.txt to that folder. But I can’t see the file in /Volumes/SSD Laufwerk/Downloads.

I just had the same issue… if you mount a host folder in docker-compose.yml like this…

    volumes:
      - ./data:/data

…and if the host folder (./data on the left side) does not exist yet, then it will be created by the docker user - and that might be the root user.

The folder in the container (/data on the right side) then “inherits” the host folder permissions and the node user that runs the workflow, cannot write to the folder owned by root.

I just changed the permissions of the host folder, now it works.

    sudo chown 1000:1000 ./data
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.