How to add custom nodes on Docker Configuration

hello community, I’m trying to add custom nodes in my n8n instance in docker but I’ve read many forums, guides and I can’t find the key. See if someone can help me out.
I have read that you have to put them inside a Custom folder and so on, but there is no way to make it work.

My docker-compose.yml file:

version: "3"
services:
  traefik:
    image: "traefik"
    restart: always
    command:
      - "--api=true"
      - "--api.insecure=true"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
      - "--entrypoints.websecure.address=:443"
      - "--certificatesresolvers.mytlschallenge.acme.tlschallenge=true"
      - "--certificatesresolvers.mytlschallenge.acme.email=${SSL_EMAIL}"
      - "--certificatesresolvers.mytlschallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/letsencrypt:/letsencrypt
      - /var/run/docker.sock:/var/run/docker.sock:ro

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - "127.0.0.1:5678:5678"
    labels:
      - traefik.enable=true
      - traefik.http.routers.n8n.rule=Host(`${SUBDOMAIN}.${DOMAIN_NAME}`)
      - traefik.http.routers.n8n.tls=true
      - traefik.http.routers.n8n.entrypoints=web,websecure
      - traefik.http.routers.n8n.tls.certresolver=mytlschallenge
      - traefik.http.middlewares.n8n.headers.SSLRedirect=true
      - traefik.http.middlewares.n8n.headers.STSSeconds=315360000
      - traefik.http.middlewares.n8n.headers.browserXSSFilter=true
      - traefik.http.middlewares.n8n.headers.contentTypeNosniff=true
      - traefik.http.middlewares.n8n.headers.forceSTSHeader=true
      - traefik.http.middlewares.n8n.headers.SSLHost=${DOMAIN_NAME}
      - traefik.http.middlewares.n8n.headers.STSIncludeSubdomains=true
      - traefik.http.middlewares.n8n.headers.STSPreload=true
      - [email protected]
    environment:
      - N8N_BASIC_AUTH_ACTIVE=${N8N_BASIC_AUTH_ACTIVE}
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ./n8n:/home/node/.n8n

Hi @Alberto_Luque_Rivas

You can use the community nodes option to get this done.
Or are you talking about private nodes?

1 Like

I need developer my custom private nodes

I think you need made your own docker image, It’s very simple , you can make it base on example on github n8n/docker/images at master · n8n-io/n8n · GitHub . I personal use debian version.

You can create a ‘custom’ folder in ‘.n8n’ and then upload your node’s entire folder there

e g.
put your node’s compiled files in .n8n/custom/node_name/v1/

and then recreate the docker containers.

Take a look at the settings:

That’s what I’m doing and it doesn’t work, when you mention a compiled node what do you mean? Following the node creation guide I follow the format “name.node.ts”, the ExampleNode is taken from an official git repository

Hi @Alberto_Luque_Rivas

You need to build the node with ‘npm build’ before you can use it.
Before the community nodes feature was released I published the node to npm and then created a new docker file including the installation via npm.
There should be a topic somewhere on the community with instructions on how to do that.

The other option of including the custom nodes in the custom folder never worked for me. Don’t know anymore what the reason was.

Check this out:
https://docs.n8n.io/integrations/creating-nodes/build/declarative-style-node/#test-your-node

Once you have successfully built the node, you’ll find a ‘dist’ folder in your working directory. This dist folder will contain your compiled node, which you then need to copy over to the custom folder of your n8n instance, as mentioned above.

1 Like