How to install n8n with Docker

n8n Logo

n8n is a powerful, open-source workflow automation tool that allows you to connect different applications and services to create complex automations. It's a self-hosted alternative to services like Zapier or Make. The recommended way to install n8n is by using Docker.

Prerequisites:
  • A server running a modern Linux distribution (e.g., Ubuntu 22.04).
  • Docker and Docker Compose installed. You can find the official guide here: Install Docker Engine on Ubuntu.
  • A domain name pointing to your server's IP address (recommended for production use).

Installation Steps

First, log into your server via SSH. Create a directory for your n8n project, and inside it, create a docker-compose.yml file and a .env file for your configuration variables.

Create Directory and Files
mkdir n8n cd n8n touch docker-compose.yml touch .env nano docker-compose.yml

Paste the following content into the docker-compose.yml file:

docker-compose.yml
version: '3' services: n8n: image: n8nio/n8n restart: always ports: - '127.0.0.1:5678:5678' environment: - N8N_HOST=${N8N_HOST} - N8N_PORT=5678 - N8N_PROTOCOL=http - NODE_ENV=production - WEBHOOK_URL=${WEBHOOK_URL} - GENERIC_TIMEZONE=${GENERIC_TIMEZONE} volumes: - ./n8n_data:/home/node/.n8n