I’m facing an issue with my Docker compose setup that includes an n8n service. When I run it on my local machine, everything operates smoothly, but deploying via GitHub Actions results in a permission denied error.
The error message I receive is:
Error: EACCES: permission denied, open '/home/node/.n8n/config'
Here’s the configuration I have for the n8n service in my docker compose:
workflow-manager:
image: docker.n8n.io/n8nio/n8n
ports:
- "5678:5678"
environment:
- N8N_HOST=workflow-manager:5678
- N8N_PORT=5678
- N8N_PROTOCOL=http
- NODE_ENV=production
- DB_TYPE=postgresdb
- DB_TABLE_PREFIX=manager_
- DB_POSTGRESDB_DATABASE=workflows
volumes:
- ./docker-files/manager/data:/home/node/.n8n
- ./docker-files/manager/files:/files
In my GitHub Actions workflow, I am attempting to establish permissions like this:
sudo useradd -m node
mkdir -p docker-files/manager
sudo chmod -R 777 docker-files/manager
sudo chown -R node:node docker-files/manager
docker-compose up -d
I have experimented with various permission settings including 777 and different ownership configurations, but nothing resolves the issue. The container works perfectly on my local setup but fails in the CI environment. Has anyone experienced similar permission issues while using n8n in GitHub Actions?
try running the container with --user=$(id -u):$(id -g)
or just skip user mapping completely and use an init container to fix permissions b4 n8n starts. GitHub Actions has weird filesystem permissions compared to local docker setups.
This is a user ID mismatch between your local setup and the GitHub Actions runner. The n8n container defaults to user ID 1000, but GitHub Actions runners use different user mappings that mess up file ownership.
Don’t bother creating a separate node user. Just run the container as root or set a specific user ID. Add this to your docker-compose service:
user: "0:0"
Or create the directory structure first and fix permissions upfront. Run this before docker-compose:
mkdir -p docker-files/manager/data docker-files/manager/files
sudo chmod -R 755 docker-files/manager
GitHub Actions runners have a different filesystem context than your local Docker, so user ID mapping matters for volume mounts to work right.
Had the exact same headache with n8n on GitHub Actions a few months back. GitHub Actions handles container user contexts differently than local Docker - that’s your problem. Don’t bother with user creation and ownership changes. Just modify the container’s user directive in your compose file. Add user: "1001:1001"
to your workflow-manager service. GitHub Actions runners usually use user ID 1001. Also, create your directory structure before the container starts. The runner needs those paths to exist with proper permissions before Docker mounts them. The difference is simple: locally your Docker daemon runs with your user context, but in CI it runs under the GitHub runner’s context with different UID mappings.