I’m opening this issue as it might be useful to many of you. I have just published a new n8n node to integrate Claude Code directly into your workflows.
Key Features:
Flexible Execution: Run Claude Code via Local, SSH, or Docker .
Context Management: Maintain context between calls thanks to persistent sessions.
Security First: Full control over Claude’s permissions (e.g., block rm, sudo, etc.).
Use Cases: Automated Code Review: Webhook MR → Claude review → Post comment. Auto-Documentation: Push → Claude generates documentation → Commit. Bug Fixing: Sentry Alert → Claude fix → Pull Request. Custom Bots: Build AI-powered bots for Slack, Telegram, Discord, GitLab, and more.
If you find this node useful, feel free to drop a on the repo—it’s always appreciated! I’m also very much open to your feedback, suggestions, or any ideas you might have.
Followed your quick start instructions (claude-code-runner using docker), successfully authenticated with Claude login, Claude Code and n8n are running on the same Linux server. Which file or directory is it referring to that doesn’t exist?
Hello @Benwhut, do you have a “workspace” folder inside your claude-code-runner’s container ?
If not, you need to create one named workspace, liked your configuration or name it as you want.
Hey! The issue is that this node doesn’t use HTTP communication between n8n and claude-code-runner. Instead, it uses docker exec to run commands inside the container.
Thanks for providing this solution. I added your steps and tried to run
sudo docker exec -it n8n-n8n-1 docker ps
but then got an error that “OCI runtime exec failed error” saying “docker” executable file is not found. Running: sudo docker exec -it n8n-n8n-1 /bin/sh
confirms that the “docker” command is missing from my n8n container. So I’ve hit another roadblock.
I’ve already spent too many hours trying to get this to work so I’ve kept it simple and am using SSH to run Claude Code through n8n, which does everything I need. Hopefully there will be a future Claude Code node that won’t be so troublesome to get working.
I just pushed an update to fix this exact issue. You were on the right track - the problem is that the standard n8nio/n8nDocker image doesn’t include Docker CLI. Mounting the Docker socket gives access to the Docker daemon, but without the docker binary itself, n8n can’t execute docker exec commands.
The solution:
I’ve added a complete “n8n + claude-code-runner” stack that builds a custom n8n image with Docker CLI included. You can set it up with:
This deploys both n8n (with Docker CLI) and claude-code-runner together.
If you prefer to keep your existing n8n setup, you just need to build a custom image. Create a Dockerfile:
FROM docker:29-cli AS docker-cli
FROM n8nio/n8n
USER root
COPY --from=docker-cli /usr/local/bin/docker /usr/local/bin/docker
RUN chmod +x /usr/local/bin/docker
USER node
Then use build: . instead of the n8n image in your docker-compose, add user: root, and keep the socket mount.
Thanks @ThomasTartrau. Your last instructions worked much better for me. I can run Claude Code using your node now!
One issue I’ve run into though is my n8n_data volume does not persist the data using your configuration. After running:
docker compose down
docker compose up -d
I lose all my workflows and it starts as a fresh n8n install.
After testing a bunch of things, the difference between my original n8n docker-compose.yml file and yours (besides the added Dockerfile.n8n and claude-code) is this line:
user: root # Required for Docker socket access
I don’t specify a user in my original docker-compose file. Could this be causing problems with persisting the data? Otherwise, do you know what might be causing your version you suggested above to not persist the n8n data?
I can confirm that the reason my n8n_data volume isn’t persisting is because of the following line in docker-compose.yml:
user: root
When I comment this line out, the n8n_data volume persists when I take the container down and then up again, but of course the claude-code node stops working.
Any ideas on how I can get both the claude-code node and the n8n_data volume to persist at the same time?