How to install n8n on Docker (manual and 1-click)
n8n is an open-source workflow automation platform — a self-hosted alternative to Zapier/Make. The most common and stable way to run it is with Docker. This guide shows how to install n8n on Docker from scratch (both docker run and docker compose), then how to do the same thing in a single click with MyPanel.
Why run n8n with Docker?
- Clean and contained — everything lives in one container, no clutter on the host OS.
- Easy updates — pull a new image and restart.
- Persistent data — a volume keeps your workflows and credentials across redeploys.
Prerequisites
- A Linux VPS (Ubuntu 22.04+ or Debian 12+).
- Docker installed. If not:
curl -fsSL https://get.docker.com | sh. - (Recommended) A domain pointed at the server IP so you can enable HTTPS.
Option 1 — Quick start with docker run
Create a data volume and start the n8n container:
docker volume create n8n_data
docker run -d --name n8n \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8nOpen http://SERVER-IP:5678 to create the owner account. n8n stores data (workflows, credentials) in /home/node/.n8n — the n8n_data volume — so it survives updates.
Option 2 — Use docker compose (recommended)
Create a docker-compose.yml:
services: n8n: image: docker.n8n.io/n8nio/n8n restart: always ports: - "5678:5678" environment: - N8N_HOST=n8n.example.com - N8N_PROTOCOL=https - N8N_PORT=5678 - WEBHOOK_URL=https://n8n.example.com/ - GENERIC_TIMEZONE=Asia/Ho_Chi_Minh - TZ=Asia/Ho_Chi_Minh volumes: - n8n_data:/home/node/.n8n
volumes: n8n_data:Start it: docker compose up -d. To update later: docker compose pull && docker compose up -d.
Important:
WEBHOOK_URLmust be your real HTTPS URL, otherwise webhook triggers (Telegram, GitHub…) won’t work correctly.
The hard part: reverse proxy + SSL
The container above only serves unencrypted traffic on port 5678. To use it over a domain with HTTPS, you need a reverse proxy (nginx/Caddy/Traefik) pointing to 127.0.0.1:5678 and a Let’s Encrypt SSL certificate (certbot). With nginx you also have to enable WebSocket (n8n uses WS for its live UI):
location / { proxy_pass http://127.0.0.1:5678; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host;}This is the most time-consuming and error-prone step: proxy config, SSL renewal, opening the right ports, keeping WebSocket alive.
Common mistakes when self-hosting n8n on Docker
- Forgetting the volume → an update wipes all your workflows.
- Wrong
WEBHOOK_URL→ webhooks never receive events. - Missing WebSocket in the proxy → the UI hangs on load.
- Expired SSL → security errors; you need a certbot renewal cron.
The easier way: 1-click n8n with MyPanel
If you’d rather not manage proxy, SSL and volumes yourself, MyPanel ships n8n in its Marketplace — install it in one click:
- Open the Marketplace, pick n8n, click Install.
- Enter your domain (pointed at the server).
- Click Install — MyPanel pulls the image, runs it in an isolated Docker container, configures the reverse proxy + WebSocket, and issues Let’s Encrypt SSL automatically.
You then manage n8n like any website: logs, start/stop, SSL, backups. Data lives in a persistent volume that survives redeploys. See the Marketplace guide.
| Manual Docker | MyPanel Marketplace | |
|---|---|---|
| Start container | Type commands | One click |
| Reverse proxy | Configure yourself | Automatic |
| SSL | Run certbot yourself | Auto-issued + renewed |
| WebSocket | Add manually | Built in |
| Backups & logs | DIY | Right in the panel |
Conclusion
Running n8n on Docker gives you a powerful self-hosted automation engine. Doing it by hand is entirely possible, but the proxy + SSL + WebSocket layer is where beginners get stuck. If you want n8n running over HTTPS in minutes:
👉 Install MyPanel for free with one command, open the Marketplace, and install n8n in a single click — the Free plan is enough to get started.