Adding a Custom Node to n8n in Docker

n8n officially supports loading community nodes from the .n8n/custom folder inside its home directory. This guide walks you through the exact commands to mount a custom node into a running n8n Docker container — from finding your container ID to verifying the node in the editor.

1. Check the Container and Home Directory

List all Docker containers to find the n8n container:

docker ps -a

Identify your n8n container ID (e.g., a417a8c95406) and start it if it is stopped:

docker start -d a417a8c95406

Find the container's home directory (usually /home/node in official n8n images):

docker exec -it a417a8c95406 sh -c 'echo $HOME'

2. Create the Custom Node Folders

Inside the container, create the folders n8n watches for custom code:

docker exec -it a417a8c95406 mkdir -p /home/node/.n8n/custom/nodes
 docker exec -it a417a8c95406 mkdir -p /home/node/.n8n/custom/credentials

Note: Do not use /root/.n8n — official n8n Docker images run as a non-root user (node).

3. Copy Your Node Files

From your local machine, copy the built node, JSON definition and icon into the container (adjust the paths for your project):

docker cp ~/Desktop/project/n8n-nodes-starter/dist/nodes/EventHub.node.js a417a8c95406:/home/node/.n8n/custom/nodes/
 docker cp ~/Desktop/project/n8n-nodes-starter/dist/nodes/EventHub.node.json a417a8c95406:/home/node/.n8n/custom/nodes/
 docker cp ~/Desktop/project/n8n-nodes-starter/dist/nodes/eventHub.svg a417a8c95406:/home/node/.n8n/custom/nodes/

If your node ships credentials:

docker cp ~/Desktop/project/n8n-nodes-starter/dist/credentials/EventHubCredential.credential.js a417a8c95406:/home/node/.n8n/custom/credentials/

4. Restart the Container

n8n only scans the custom folder at startup, so restart the container:

docker restart a417a8c95406

5. Access n8n and Verify

If the node does not appear, check the container logs for module loading errors with docker logs a417a8c95406 — the most common causes are a missing .node.json file or a build that was not recompiled.

Related Articles

A.M. Rinas

Written by A.M. Rinas

Full-Stack Software Engineer working on web applications, DevOps automation, and databases. More about me on the about page, or say hi through the contact page and LinkedIn.

← Back to all articles