Customized scalable N8N image
2.3K
n8n is an extendable workflow automation tool that enables you to connect different systems, databases, and APIs without writing complex code. With its node-based approach, you can easily build, run, and scale automated workflows.
To run n8n quickly using an SQLite database, execute the following command:
docker run -d --name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
hmtanbir/n8n:latest
Once running, access the editor UI at: http://localhost:5678
Important
Always persist the `/home/node/.n8n` directory using a volume to ensure your workflows, database, and encryption keys are not lost when the container restarts or updates.
For production environments, it is recommended to run n8n with PostgreSQL (for persistence) and Redis/Dragonfly (for Queue Mode scaling).
Create a docker-compose.yml file with the following configuration:
services:
postgres:
image: hmtanbir/postgres:latest
container_name: n8n-postgres
restart: unless-stopped
environment:
POSTGRES_USER: n8n
POSTGRES_PASSWORD: n8n-secure-password-change-me
POSTGRES_DB: n8n
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U n8n -d n8n"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: hmtanbir/dragonfly:latest
container_name: n8n-redis
command: ["--logtostderr", "--dir=/data"]
restart: unless-stopped
volumes:
- redis_data:/data
healthcheck:
test: ["CMD-SHELL", "redis-cli ping | grep PONG || exit 1"]
interval: 10s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "2.00"
memory: 2G
reservations:
cpus: "1.00"
memory: 1G
n8n:
image: hmtanbir/n8n:latest
build:
context: .
dockerfile: docker/images/n8n/Dockerfile
container_name: n8n-app
restart: unless-stopped
ports:
- "5678:5678"
environment:
- NODE_ENV=production
- N8N_PORT=5678
- N8N_PROTOCOL=http
- N8N_HOST=localhost
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_DATABASE=n8n
- DB_POSTGRESDB_USER=n8n
- DB_POSTGRESDB_PASSWORD=n8n-secure-password-change-me
# Enable Redis scaling (Queue mode) - unlocked by disabling license checks
- EXECUTIONS_MODE=queue
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_BULL_REDIS_PORT=6379
# Encryption key (Crucial for production - change this!)
- N8N_ENCRYPTION_KEY=change-this-to-a-secure-random-key-in-production
volumes:
- n8n_data:/home/node/.n8n
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
postgres_data:
redis_data:
n8n_data:
Start the stack:
docker compose up -d
| Variable | Description | Default |
|---|---|---|
N8N_ENCRYPTION_KEY | Key used to encrypt credentials. Must be kept secure & persistent. | Auto-generated if omitted |
EXECUTIONS_MODE | Set to queue to enable multi-worker processing with Redis/Dragonfly. | regular |
DB_TYPE | Type of database to connect to. Supports sqlite or postgresdb. | sqlite |
GENERIC_TIMEZONE | The timezone n8n uses (e.g. America/New_York or Europe/Berlin). | America/New_York |
To update n8n to the latest version under Docker Compose:
docker compose pull
docker compose down
docker compose up -d
Content type
Image
Digest
sha256:92380efd2…
Size
341 MB
Last updated
15 days ago
docker pull hmtanbir/n8n