Auto-update Docker containers on new image digests with Docker API
Go to WorkflowDescription
Quick overview
This workflow runs hourly to check a Docker registry for updated image digests, and if a new image is available it pulls it, recreates a Docker container with the configured port mapping, and waits for the container health check to pass.
How it works
Runs every hour on a schedule.
Loads the target container name, image reference, and host/container ports from a central configuration step.
Uses the Docker Registry API to inspect the image manifest and read the currently published digest, then inspects the same image locally.
Compares the published digest to the local image digest to decide whether an update is needed.
If an update is needed, pulls the latest image, removes the existing container, and creates a new container with a health check and restart policy.
Waits up to 120 seconds for the new container to reach the healthy state and routes to either a success placeholder or an unhealthy-alert placeholder.
If no update is needed, ends without making changes.
Setup
Configure Docker API credentials/connection details so n8n can inspect images and manage containers on your Docker host.
Update the image reference (for example, repo/name:tag), container name, and port mapping values in the Settings step.
Ensure the container image supports the configured health check command (default uses wget against http://localhost:/) and adjust it to match your service.
Replace the success and unhealthy placeholders with your notification target (for example, Slack, email, or Discord) if you want alerts.