Loading...
How to automate self-hosted n8n instance updates

How to automate self-hosted n8n instance updates

Jonas Scholz - Co-Founder von sliplane.ioJonas Scholz
3 min

Keeping your self-hosted services up to date is important, especially when it comes to automation tools like n8n. Updates bring new features, bug fixes, and critical security patches. But if you're running your instance with Docker, you might forget to manually pull the latest image and restart your container.

Good news: you can automate this entire process using a simple tool called Watchtower.

In this guide, I'll show you how to set up Watchtower to automatically keep your n8n container updated.

Step 1: Your current setup

If you followed my earlier n8n self-hosting guide, your docker-compose.yml probably looks like this:

services:
  n8n:
    image: docker.io/n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

This pulls the latest image when you first start the container, but it won't keep it up to date automatically.

Step 2: Add Watchtower

To automate updates, add Watchtower as another service in your Compose file:

services:
  n8n:
    image: docker.io/n8nio/n8n:latest
    restart: always
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n

  watchtower:
    image: containrrr/watchtower
    restart: always
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    command: --cleanup

volumes:
  n8n_data:

Or run it standalone:

docker run -d \
  --name watchtower \
  -v /var/run/docker.sock:/var/run/docker.sock \
  containrrr/watchtower \
  --cleanup

Step 3: Understand the risks

Watchtower will automatically pull the latest version of n8n and restart your container when a new version is available.

Here's the important part:

  • n8n attempts to gracefully shut down by finishing or stopping running workflows (with up to 30 seconds timeout).
  • However, there's still risk involved, especially if a long-running workflow gets cut off or if a new version includes breaking changes.
  • Major upgrades can change APIs, node behavior, or database structure.

If you run critical workflows, consider using a tagged version (like n8nio/n8n:1.44.0) and upgrading manually after testing.

Step 4: Monitor and adjust

You can view Watchtower logs with:

docker logs watchtower

There are also advanced options for controlling update intervals, sending notifications, or only watching specific containers. Check out the full Watchtower docs for details.

Best Practices

  • Use tagged images in production Avoid surprises. Stick to a known version unless you're OK with automatic changes.
  • Back up your volume Your n8n workflows and credentials live in /home/node/.n8n. Don't lose them.
  • Monitor your updates Especially when using latest, you should at least keep an eye on update logs.

Done!

With Watchtower, you can keep your self-hosted n8n instance up to date with zero effort. Just be mindful of the risks with automatic updates, and consider pinning versions if you need stability.

Want to deploy and manage Docker containers without dealing with server maintenance? Sliplane is made for that!

Welcome to the container cloud

Sliplane makes it simple to deploy containers in the cloud and scale up as you grow. Try it now and get started in minutes!