Write to windows folder from within Docker n8n

I use n8n v2 hosted in a docker container. I want to write a file with the Read/Write node.

The field for the file+path is: local_files/test.txt

I mounted local_files in the docker-compose.yml:
volumes:
- ./n8n_data:/home/node/.n8n
- ./n8n_files:/home/node/local_files

The folder “n8n_files” exists beside the “n8n_data” folder.

But try to write the file, I get the error:

The file "/home/node/local_files/test.txt" is not writable.

The error means n8n inside the container doesn’t have permission to write to that directory. By default, the container runs as the user (UID 1000). If your host folder isn’t owned by UID 1000 or doesn’t have write permissions, the container can’t write to it. Adjust folder permissions on the host
Run these commands in the same directory as your :

Make sure the folder exists

mkdir -p ./n8n_files

Give ownership to UID 1000 (the ‘node’ user inside the container)

sudo chown -R 1000:1000 ./n8n_files

Ensure write permissions

chmod -R 755 ./n8n_files

This aligns host folder ownership with the container’s user.

Hi @konradsl,

Did you follow the instructions to enable the file location in the environment variables? See below breaking change in version 2

1 Like

I would recommend to change the volume mount to:
./n8n_files:/files
And then allow access to this directory with the environment variable N8N_RESTRICT_FILE_ACCESS_TO like this:
N8N_RESTRICT_FILE_ACCESS_TO:”/files”

3 Likes

Thanks @markup
This worked :slight_smile:

1 Like

Thanks @markup for this

1 Like

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