How to upgrade n8n uses Docker on DigitalOcean

To upgrade self-hosted n8n instance on a DigitalOcean 1-Click Droplet, which typically uses Docker and Docker Compose, follow these step-by-step instructions.

This guide assumes you have SSH access to your Droplet and basic familiarity with terminal commands. Regular updates are crucial for accessing new features, bug fixes, and security enhancements.

Prerequisites

  1. DigitalOcean Account: Access to your DigitalOcean Cloud Control Panel.
  2. SSH Access: SSH credentials (root or a user with sudo privileges) or use the DigitalOcean web console.
  3. Backup: Export your workflows via the n8n UI and create a Droplet snapshot in the DigitalOcean dashboard to ensure data safety.
  4. Docker Compose Setup: The n8n 1-Click Droplet uses Docker Compose, with configuration files typically located in /opt/n8n-docker-caddy.

Step-by-Step Guide to Upgrade n8n

Access Your Droplet

  • Open the DigitalOcean Cloud Control Panel (cloud.digitalocean.com).
  • Navigate to Droplets in the left-hand menu and select your n8n Droplet.
  • Click the Console button to open a web-based terminal, or use SSH to connect:
ssh root@YOUR_DROPLET_IP

Replace YOUR_DROPLET_IP with your Droplet’s public IP address.

Navigate to the n8n Configuration Directory

  • The n8n 1-Click Droplet typically stores its Docker Compose setup in /opt/n8n-docker-caddy. Change to this directory:
cd /opt/n8n-docker-caddy

If you receive a “No such file or directory” error, verify the directory exists:

ls /opt

If the directory is missing or named differently, contact DigitalOcean support or check your setup documentation. The folder might be in another location like /home/<USERNAME>/n8n-docker-caddy.

Pull the Latest n8n Image

  • Update the Docker image for n8n to the latest version:
docker compose pull

This command fetches the latest n8n image specified in your docker-compose.yml file (usually n8n:latest).

Stop and Remove the Existing n8n Container

  • Stop and remove the current n8n container to prepare for the new image:
docker compose down

This stops the n8n and Caddy containers but preserves your data (stored in Docker volumes or local folders like local_files).

Start the Updated n8n Instance

  • Recreate and start the containers with the new image:
docker compose up -d

The -d flag runs the containers in detached mode (in the background). Docker Compose will recreate the containers using the latest n8n image.

Verify the Update

  • Open your n8n instance in a web browser (e.g., https://n8n.yourdomain.com).
  • Perform a hard refresh (Ctrl + Shift + R or Cmd + Shift + R) to clear the browser cache.
  • Check the n8n version in the Settings or About section of the n8n UI to confirm the update.
  • Ensure your workflows are intact and test a few to verify functionality.
  • If an update notification persists in the UI, repeat the hard refresh or clear the cache again.

Optional: Automate Future Updates

  • To simplify future updates, consider using Watchtower, a tool that automatically updates Docker containers:
        docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower

Watchtower checks for new n8n images and updates your containers automatically. Be cautious, as automatic updates may introduce breaking changes—always back up before enabling.

Important Notes

  • Backup First: Always export workflows and create a Droplet snapshot before upgrading to avoid data loss. Snapshots can be created in the DigitalOcean dashboard under Droplets > Snapshots.
  • Check Release Notes: Review n8n’s release notes on GitHub (https://github.com/n8n-io/n8n/releases) for breaking changes or new features that may affect your workflows.
  • DNS and Firewall: Ensure your subdomain (e.g., n8n.yourdomain.com) is correctly pointed to the Droplet’s IP and that ports 80 and 443 are open in the firewall (this is usually preconfigured in the 1-Click Droplet).
  • Troubleshooting:
    — If the docker compose commands fail, ensure Docker and Docker Compose are installed (docker –version and docker compose version).
    — If you can’t access n8n after the update, check the container logs:
docker compose logs

— For persistent issues, consult the n8n community forum (community.n8n.io) or DigitalOcean support.

  • Version Pinning: The docker-compose.yml file typically uses the n8n:latest image. If you need a specific version, edit the file (e.g., image: n8n:1.50.0) before pulling and restarting.

Sources

Leave a Reply