N8n docker importing custom nodes safely and persistent

Hey team

What would be the best practice in regards to importing a community node into a docker - and making it persistent?

There are a few community nodes such as the Google Ads api that arent yet in the formal lib, keen to get these into our n8n instances safely.

Secondly - is there roadmap scope to have nodes to be imported from the UI?

DT

Hey @Dwayne_Taylor,

I am not a member of the n8n team but I have installed custom node modules in n8n images recently.

There is this section in the docs explaining how to install a custom node module. Any changes that you make to a Docker container are not persistent when not using Docker volumes or mounting directories to your container. This means that you should probably build your own container.

For this you need to install Docker, and then create a Dockerfile. This file tells Docker which steps to perform to create your container. You can either copy and paste the Dockerfile from n8n docs or create an even simpler one:

# The base image you will be using is the latest prebuilt n8n image
FROM n8nio/n8n:latest

# Go into the directory where n8n is installed and install your custom module
RUN cd /usr/local/lib/node_modules/n8n && npm install @digital-boss/n8n-nodes-google-ads

You can then build your Docker image running the following command in the folder where your Dockerfile is located:

docker build -t yourImageName:latest .

Let me know if you need any further help.

3 Likes

This is how I do it at the moment, We are working on making installing custom nodes easier so soon (not sure on dates) this process will be a lot better.

2 Likes