I’m having trouble with our docker compose setup for testing. It works fine on local machines (macOS) but fails in GitHub Actions with a permission error:
Error: EACCES: permission denied, open '/home/node/.n8n/config'
This happens with an n8n container that should provide an HTTP API. Here’s a snippet from our docker-compose file:
workflow_engine:
image: custom_workflow_image:latest
ports:
- "6789:6789"
environment:
- ENGINE_HOST=workflow_engine:6789
- ENGINE_PORT=6789
- ENGINE_PROTOCOL=http
- NODE_ENV=production
- DB_TYPE=customdb
- DB_TABLE_PREFIX=workflow_
- DB_CUSTOMDB_DATABASE=workflow
volumes:
- ./SETUP/workflow_engine/data:/home/user/.workflow
- ./SETUP/workflow_engine/files:/files
In the GitHub Actions workflow, I’ve tried:
sudo useradd -m user
mkdir -p SETUP/workflow_engine
sudo chmod -R 777 SETUP/workflow_engine
sudo chown -R user:user SETUP/workflow_engine
docker-compose up -d
I’ve tried different permissions and owners, but it always fails. Any ideas on how to fix this?
I’ve encountered similar permission issues with n8n in continuous integration environments. The issue is often due to the container user not having the proper rights to write to the mounted volumes. In my experience, modifying the Dockerfile to create the necessary directories with correct permissions can help resolve the problem. Also, specifying a UID:GID in the docker-compose file using the user directive to match the mounted volumes can improve compatibility with the GitHub Actions runner.
If these steps do not fully eliminate the error, consider reconfiguring n8n to use an alternative directory for configuration, ensuring that any permission adjustments do not compromise security.
hey swiftcoder42, sounds like a tricky issue! have u tried running the container as root? u could add user: root
to ur docker-compose file for the workflow_engine service. also, double-check the paths in ur volumes - make sure they match exactly with what the container expects. good luck!
I’ve dealt with similar n8n permission issues in CI environments before. One solution that worked for me was adjusting the Dockerfile to create the necessary directories with the correct permissions before starting n8n. Something like:
RUN mkdir -p /home/node/.n8n && chown -R node:node /home/node/.n8n
Also, make sure your volumes in docker-compose are mapping to the correct paths. I noticed you’re using /home/user/.workflow, but n8n typically uses /home/node/.n8n.
If that doesn’t work, you might need to run n8n with a different user in your docker-compose:
workflow_engine:
user: "${UID}:${GID}"
And set UID and GID in your GitHub Actions workflow to match the runner’s user. This approach has solved permission issues for me in the past without compromising security.