N8n docker importing custom nodes safely and persistent

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.

6 Likes