Error in Certificate creation due to Directory permissions

Describe the problem/error/question

I keep my Docker volumes in a neat directory. When creating the new n8n containers using the following compose, it gets stuck in the certificate generation. I don’t need certificates because I use port forwarding and Cloudflare already provided the SSL to my domain which then gets stored in the npm for proxy.

In my tests, the only directory that seems to work is in the docker default directory which is /var/lib/docker/volumes…the nested directory Configs or /opt/stacks or anything but….

services:
  n8n:
    image: n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    environment:

      - [email protected]
      - N8N_BASIC_AUTH_PASSWORD=Kissmefool1
    volumes:
      - /var/lib/Docker/volumes/Configs/n8n/data:/home/node/.n8n
      - /var/lib/Docker/volumes/Configs/n8n/files:/files
    depends_on:
      - postgres
    # labels:
      # - "traefik.enable=true"
      # - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.rule=Host(`${TRAEFIK_DOMAIN}`)"
      # - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.entrypoints=websecure"
      # - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.tls.certresolver=${TRAEFIK_CERT_RESOLVER}"
      # - "traefik.http.services.${TRAEFIK_ROUTER_NAME}.loadbalancer.server.port=5678"

  # If you're running your own external PostgreSQL instance, you can comment out this service
  postgres:
    image: postgres:15
    restart: always
    environment:
      - POSTGRES_DB=n8n
      - POSTGRES_USER=n8n
      - POSTGRES_PASSWORD=changeme123
    volumes:
      - /var/lib/Docker/volumes/Configs/n8n/postgres-data:/var/lib/postgresql/data

What is the error message (if any)?

n8n-1       | No encryption key found - Auto-generating and saving to: /home/node/.n8n/config
n8n-1       | No encryption key found - Auto-generating and saving to: /home/node/.n8n/config
n8n-1       | Error: EACCES: permission denied, open '/home/node/.n8n/config'
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • n8n version:
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker and Portainer
  • Operating system: Ubuntu 22.04

Hey @okynnor hope all is good.

If appears that the folder you are mounting into the container is not accessible for n8n.

Try to chown this folder recursively and set the user/group to 1000, it should look something like

sudo chown -R 1000:1000 /var/lib/Docker/volumes/Configs/n8n/data

Is there a reason you don’t want to just use regular named volumes?

1 Like

I’m curious - is this a feature of n8n? 1000 is the first non-root user. Usually, I run everything as root:root but this is odd that n8n rejects it.

BTW, this permission issue fixed it and n8n is running.

1 Like

Modern version of n8n is running as “node” user (used to be “root” a while back), so by changing the ownership to 1000:1000 you let that first user (“node”) access the folder.

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