Skip to content
BotServBotServ
n8nInstallationDockerSelf-HostingWorkflow

Install n8n

Install and configure n8n with Docker, Docker Compose, setup, first workflows and troubleshooting.

S

schutzgeist

5 min read
Install n8n

Installing n8n

What this article covers

  • How to install n8n with Docker or Docker Compose.
  • How to configure the basics.
  • How to create your first workflow.
  • Which environment variables matter.
  • Troubleshooting common issues.

Introduction: installing n8n explained

n8n is a workflow automation tool that connects processes visually. You install it on your server, open it in a browser, and build workflows with drag-and-drop. n8n is open source, self-hosted, and includes over 400 integrations.

This article is for users who want to install n8n. You should have basic Docker knowledge. See Docker Basics for fundamentals.

Why do you need n8n?

Imagine automating recurring tasks: processing emails, syncing databases, generating reports. Instead of writing scripts, you build workflows visually. n8n makes automation accessible without needing to code.

n8n installation in brief

n8n is a self-hosted workflow tool. You install it with Docker, open it in a browser, and create workflows with drag-and-drop. For AI workflows, connect n8n to Ollama.

The core idea is simple: visual workflows instead of scripts.

Who is this article for?

  • Self-hosters who want to install n8n.
  • Automation builders who want to create workflows.
  • Developers implementing automation.
  • Teams automating repetitive tasks.

Basic Docker knowledge is helpful.

Key terms

  • n8n - Workflow automation. Useful for: the tool itself.
  • Docker - Container platform. Useful for: installation.
  • Docker Compose - Multi-container tool. Useful for: complex setups.
  • Workflow - Sequence of steps. Useful for: what n8n automates.
  • Node - Building block in a workflow. Useful for: individual steps.
  • Ollama - Local model server. Useful for: AI workflows.

Prerequisites

  • Docker installed. See Docker Basics.
  • Docker Compose installed.
  • At least 1GB RAM, 1 CPU core.
  • Port 5678 available (default).

Installation with Docker Compose

1. Create docker-compose.yml

version: "3.8"

services:
  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=0.0.0.0
      - N8N_PORT=5678
      - N8N_PROTOCOL=http
      - WEBHOOK_URL=http://localhost:5678/
      - GENERIC_TIMEZONE=Europe/Berlin
      - TZ=Europe/Berlin
    volumes:
      - n8n_data:/home/node/.n8n
    networks:
      - n8n-network

volumes:
  n8n_data:

networks:
  n8n-network:
    driver: bridge

2. Start the container

docker compose up -d

3. Open n8n

Open your browser: http://localhost:5678

Installation with Docker (without Compose)

docker run -d \
  --name n8n \
  -p 5678:5678 \
  -e N8N_HOST=0.0.0.0 \
  -e N8N_PORT=5678 \
  -e WEBHOOK_URL=http://localhost:5678/ \
  -e GENERIC_TIMEZONE=Europe/Berlin \
  -e TZ=Europe/Berlin \
  -v n8n_data:/home/node/.n8n \
  --restart unless-stopped \
  n8nio/n8n:latest

Getting started

1. Create an admin account

On first startup, you’ll be prompted to create an admin account.

2. Create your first workflow

  1. Click “New Workflow”.
  2. Drag a “Manual Trigger” node into the workflow.
  3. Add a “Set” node next to it.
  4. Connect both nodes.
  5. Click “Execute Workflow”.

3. Save the workflow

Click “Save” and give your workflow a name.

Important environment variables

VariableDescriptionExample
N8N_HOSTHost for n8n0.0.0.0
N8N_PORTPort for n8n5678
N8N_PROTOCOLhttp or httpshttp
WEBHOOK_URLURL for webhookshttp://localhost:5678/
GENERIC_TIMEZONETimezoneEurope/Berlin
TZTimezoneEurope/Berlin
N8N_ENCRYPTION_KEYEncryption keyrandom string
DB_TYPEDatabase typesqlite (default)
EXECUTIONS_DATA_PRUNEDelete old executionstrue
EXECUTIONS_DATA_MAX_AGEMax age in days30

Connecting to Ollama

To connect n8n with Ollama, both containers need to be on the same network:

version: "3.8"

services:
  ollama:
    image: ollama/ollama:latest
    container_name: ollama
    restart: unless-stopped
    ports:
      - "11434:11434"
    volumes:
      - ollama_data:/root/.ollama
    networks:
      - n8n-network

  n8n:
    image: n8nio/n8n:latest
    container_name: n8n
    restart: unless-stopped
    ports:
      - "5678:5678"
    environment:
      - N8N_HOST=0.0.0.0
      - WEBHOOK_URL=http://localhost:5678/
    volumes:
      - n8n_data:/home/node/.n8n
    networks:
      - n8n-network

volumes:
  ollama_data:
  n8n_data:

networks:
  n8n-network:
    driver: bridge

In n8n, use http://ollama:11434 as your Ollama URL.

See n8n-Ollama Integration for details.

Security notes

  • Set a strong password: Create a strong admin password.
  • Use HTTPS in production: Enable HTTPS for production deployments. See TLS Certificates.
  • Don’t expose to the internet: Never expose n8n to the internet without authentication.
  • Enable encryption: Set N8N_ENCRYPTION_KEY for sensitive data.
  • Backup regularly: Back up your n8n data often. See Backup.

Troubleshooting

n8n won’t start

# Check logs
docker logs n8n

# Common causes:
# - Port 5678 is in use
# - Insufficient memory
# - Database corruption

Port already in use

# Use a different port
docker run -d -p 5679:5678 n8nio/n8n:latest

Database error

# Reset the database
docker exec -it n8n n8n db:reset

Ollama not reachable

# Check if Ollama is running
docker ps | grep ollama

# Check network
docker network inspect n8n-network

Practical example: your first workflow

// Workflow: Create a log entry every hour

// 1. Schedule Trigger: Every hour
// 2. Function Node:
return {
  timestamp: new Date().toISOString(),
  message: "Hourly check"
};

// 3. HTTP Request: Send to Ollama (optional)

Further reading

Key takeaways:

  • n8n is a self-hosted workflow tool.
  • Install with Docker or Docker Compose.
  • Runs on port 5678, create an admin account at startup.
  • Connect to Ollama for AI workflows.
  • Security: strong password, HTTPS, don’t expose publicly.

FAQ

What is n8n?

n8n is a workflow automation tool. You build workflows visually with drag-and-drop, no coding required. n8n is open source and self-hosted.

How do I install n8n?

The easiest way is with Docker: docker run -d -p 5678:5678 n8nio/n8n:latest. Or use Docker Compose for more complex setups.

What port does n8n run on?

By default, port 5678. You can change it with -p, for example -p 8080:5678 to use port 8080.

Should I use Docker or Docker Compose?

Docker is fine for simple setups. For more complex deployments (n8n plus Ollama plus a database), Docker Compose is better because you define everything in one file.

Where is data stored?

In a Docker volume (n8n_data). This volume holds your workflows, credentials, and configuration. Back it up regularly.

How do I connect n8n to Ollama?

Run both on the same Docker network, then use http://ollama:11434 as the URL in n8n. See the n8n-Ollama integration guide for details.

How do I enable HTTPS?

Set N8N_PROTOCOL=https and WEBHOOK_URL=https://your-domain.com. Use a reverse proxy (Nginx, Traefik) to handle TLS certificates.

Is n8n secure?

Yes, if you secure it properly: use a strong password, enable HTTPS, don’t expose it publicly, and activate encryption.

How do I back up n8n?

Back up the n8n_data volume. It contains all your workflows and credentials. Export regularly or back up the volume.

n8n won’t start. What do I do?

Check logs with docker logs n8n. Common causes: port in use, insufficient memory, or database corruption.

Sources and further reading

Back to Blog
Share:

Related Posts