Automated Docker Container Update with Telegram Approval - n8n Workflow

Use this powerful n8n workflow to automate checking and updating your self-hosted n8n Docker instance. This n8n template integrates SSH for executing Docker commands and Telegram for secure, manual approval.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

DevOps Engineers managing self-hosted infrastructure.
Technical users running n8n via Docker and docker-compose.
Anyone needing a scheduled, hands-off monitoring system for their critical n8n services.
System administrators seeking secure, approved container update automation using an n8n node.

Overview

Keeping a self-hosted application like n8n up-to-date is crucial but often repetitive. This n8n workflow solves this by creating a highly secure, scheduled automation for container management. Instead of manually checking GitHub releases and running SSH commands, this n8n automation handles the entire pipeline.

The unique value of this n8n template lies in its safety mechanism: it requires explicit user approval via a Telegram message before any modification commands (like docker compose up) are executed. This provides peace of mind, ensuring that updates only happen when you are ready, making this n8n workflow an essential tool for robust DevOps practices. By utilizing various powerful n8n node types, the entire update process is reliable and fully auditable.

How it Works

The n8n workflow is designed to run automatically on a schedule (defined by the n8n trigger) or manually.


  1. Trigger and Setup: The process begins either via the Schedule Trigger (set to run every three days) or the manual When clicking ‘Test workflow’ n8n trigger. Initial variables, including the working-directory and n8n-container-name, are defined in the Set Default variable n8n node.

  2. Version Retrieval: Two parallel paths execute: the check n8n installed version SSH n8n node determines the current container version via docker inspect, and the Github HTTP Request n8n node fetches the latest released version tag from the official n8n repository.

  3. Data Processing: The version string retrieved from GitHub often includes 'n8n@' prefix; the Edit Version String n8n node cleans this prefix for accurate comparison.

  4. Merging and Comparison: The Merge Results n8n node combines the installed and latest versions. The Comapre Two Input n8n node then checks if the versions are equal.

  5. Decision Path:

If Up-to-Date (False branch): The workflow terminates after sending an optional informational message via the Telegram Notif n8n node.
If Update Needed (True branch): The workflow proceeds to the Telegram Approve n8n node, which sends a notification asking for permission to proceed. This specific n8n node pauses the execution until an answer is received.

  1. Execution: Upon Telegram approval, the workflow executes the necessary SSH commands in sequence: Pull n8n Image, docker compose pull, and finally, docker compose up to recreate the container with the latest image.

  2. Confirmation: The Telegram Notif1 n8n node sends a final confirmation that the n8n update has been successfully completed.

Installation Guide

To deploy this automated n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON and import it into your n8n instance via the Workflows tab (New -> Import from JSON).

  2. Set Credentials:

SSH Credentials: You must configure an SSH Password credential (tqNyOVbQTikb35Tk) that allows password authentication and execution of sudo docker commands on the host machine where n8n is running.
Telegram Credentials: Set up a Telegram API credential (Zx3ibmlSzRKZQsFa) connected to a bot for sending notifications and receiving approvals.

  1. Configure Default Variables: Edit the Set Default variable n8n node and provide values for:

working-directory: The full path to the directory containing your docker-compose.yml file.
n8n-container-name: The exact name of your running n8n Docker container.
* telegram-id: Your personal Telegram Chat ID (obtainable from bots like @getidbot).

  1. Activate: Enable the n8n workflow to allow the Schedule Trigger to start working.

Node Details

Schedule Trigger / Manual Trigger: These n8n triggers initiate the version check, allowing the n8n workflow to run periodically or on demand.
Set Default variable (Set n8n node): Crucial configuration node defining environment variables (working-directory, n8n-container-name, telegram-id) used throughout the n8n workflow for dynamic command execution.
check n8n installed version (SSH n8n node): Executes sudo docker inspect... | jq -r '.[0].Config.Labels["org.opencontainers.image.version"]' to securely retrieve the currently installed n8n version label from the Docker host.
Github HTTP Request (HTTP Request n8n node): Connects to the GitHub API to fetch the tag_name of the latest n8n release.
Edit Version String (Set n8n node): Data manipulation step that strips 'n8n@' from the release tag, ensuring a clean version number for comparison with the installed version.
Comapre Two Input (IF n8n node): The core decision point of the n8n workflow. It compares the two version strings (installed vs. latest) to determine if an update is required.
Telegram Approve (Telegram n8n node): Uses the sendAndWait operation, creating a manual gate. The n8n workflow pauses here, waiting for the user to approve the update before executing risky SSH commands.
Pull n8n Image / docker compose pull (SSH n8n node): Executes the remote docker pull and docker compose pull commands to fetch the necessary updated images.


  • docker compose up (SSH n8n node): Executes sudo docker compose up -d to safely stop the old container and start a new one using the recently pulled image, completing the n8n update process.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

I'm Jaber Zare, a freelance DevOps engineer specializing in cloud infrastructure, automation, and scalable systems. With expertise in Kubernetes, CI/CD, and cloud platforms, I help businesses optimize their workflows and improve system reliability. If you're looking for top-notch DevOps/Cloud solutions, let's connect!

Featured*