n8n is a powerful open-source workflow automation tool. If you're deploying it yourself using Docker Compose, it's important to pin the image version for reliability and control.
β Prerequisites
Before you begin, ensure your system has:
- Docker installed
- Docker Compose installed
- A working terminal (Linux, macOS, or WSL on Windows)
- Basic knowledge of Docker CLI
Check versions:
docker -v
docker compose version
π§± Step-by-Step Installation
1οΈβ£ Create a directory
mkdir -p ~/n8n-docker && cd ~/n8n-docker
2οΈβ£ Create docker-compose.yml
version: "3.7"
services:
n8n:
image: n8nio/n8n:1.103.2 # β
Pin the version
ports:
- "5678:5678"
environment:
- GENERIC_TIMEZONE=Asia/Bangkok
- N8N_BASIC_AUTH_ACTIVE=true
- N8N_BASIC_AUTH_USER=admin
- N8N_BASIC_AUTH_PASSWORD=your-password
volumes:
- ./n8n_data:/home/node/.n8n
restart: unless-stopped
π§ Explanation:
-
volumes
: persists your workflows and credentials. -
restart: unless-stopped
: auto-restarts unless manually stopped. -
image: n8nio/n8n:1.103.2
: fixes version to avoid surprises on update. -
restart: unless-stopped
: self restart
3οΈβ£ Start the container
docker compose up -d
4οΈβ£ Access n8n
Visit: http://localhost:5678
Login: admin
/ your-password
π Why You Should Pin the Docker Image Version
Avoid using latest
β it could break your workflows after unexpected updates.
Behavior | Result |
---|---|
latest |
May auto-update on pull, could introduce breaking changes |
:1.103.2 |
Stable and predictable version |
π Check Docker Hub tags and release notes.
π Upgrade Procedure
- Backup the
./n8n_data
directory - Update the image tag in
docker-compose.yml
- Pull and restart and verify system health
docker compose pull
docker compose up -d
docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
923e00afb0bc n8nio/n8n:1.103.3 "tini -- /docker-entβ¦" 2 hours ago Up 2 hours 0.0.0.0:5678->5678/tcp n8n-n8n-1
β Summary
- Self-host n8n with Docker Compose
- Pin the Docker image version
- Secure access with basic auth
- Persist data with volume mounts
- Safe upgrade flow
#n8n #Automation #SelfHosted
Top comments (0)