Error while Writing File

Hi,

Im getting a permission error while writing a file in n8n.

I have n8n running on docker and here is my docker-compose.yaml file.

version: "3"

services:

    n8n_5001:
      image: n8nio/n8n:latest
      ports:
        - "5001:5001"
      environment:
        - N8N_BASIC_AUTH_ACTIVE=true
        - N8N_BASIC_AUTH_USER
        - N8N_BASIC_AUTH_PASSWORD
        - N8N_HOST=${DOMAIN_NAME}
        - N8N_PORT=5001
        - N8N_PROTOCOL=https
        - NODE_ENV=production
        - N8N_PATH
        - N8N_LISTEN_ADDRESS=0.0.0.0
        - WEBHOOK_TUNNEL_URL=https://${DOMAIN_NAME}${N8N_PATH}
        - VUE_APP_URL_BASE_API=https://${DOMAIN_NAME}${N8N_PATH}
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /root/n8n_5001/.n8n_5001:/root/.n8n_5001

I’ve also given permission to the directory

drwxrwxrwx  3 1001 1001  4096 Nov  2 08:48 n8n_5001

There are two problems:

  1. Unrelated to your problem but right now all the information will be lost after every restart as you mount to /root/.n8n_5001. n8n will not care about that folder as it looks only for /root/.n8n. So you would have to change the line to: - /root/n8n_5001/.n8n_5001:/root/.n8n
  2. Your actual problem. You are writing to the folder /data but that data does not exist and fails for that reason. If you want to write to that folder and that folder should be accessible from the host you have to add a line like: - /root/n8n_5001_data:/data

Thanks a lot @jan :smiley:

You are welcome. Have fun!