Self Hosting Locally With Docker Desktop and Ollama
Guide to self-hosting n8n with Docker Desktop and Ollama, using a starter kit to run local LLMs, Postgres, and Qdrant via Docker Compose.
In this lesson you’ll learn how to run n8n locally using Docker Desktop and the n8n-io/self-hosted-ai-starter-kit repository, which includes Ollama as a local LLM runtime. Follow the steps below to clone the starter kit, configure environment variables, and bring up the stack with Docker Compose.
Overview
Clone the n8n self-hosted AI starter kit repository.
Copy and edit the .env file to configure secrets and host settings.
Start the stack with Docker Compose using the profile appropriate for your hardware.
If you prefer managing Ollama outside the compose stack, install via https://ollama.ai/docs and set OLLAMA_HOST in .env
Step 1 — Clone the repo and create your .env
git clone https://github.com/n8n-io/self-hosted-ai-starter-kit.gitcd self-hosted-ai-starter-kitcp .env.example .env# Edit .env to update secrets, passwords and any host settings (e.g., POSTGRES_PASSWORD, OLLAMA_HOST)
Open .env and update secrets (database credentials, encryption keys, JWT secrets, etc.) before starting the stack. If you plan to use a separately installed Ollama instance, set OLLAMA_HOST (for example: http://localhost:11434).
Step 2 — Start the stack with Docker Compose
Choose the profile that matches your hardware. Each profile brings up the same services with configuration appropriate to the runtime.
Profile
Use case
Command
cpu
CPU-only environments (Mac Apple Silicon / no GPU)
docker compose --profile cpu up
gpu-nvidia
Linux machines with NVIDIA GPUs and drivers
docker compose --profile gpu-nvidia up
gpu-amd
Machines with AMD GPUs
docker compose --profile gpu-amd up
Example:
docker compose --profile cpu up
Note: The first run pulls several images (Postgres, Qdrant, n8n, Ollama, etc.). This can take a few minutes depending on network speed.Common services started
Service
Purpose
Postgres
Primary n8n database
Qdrant
Vector database for embeddings
n8n
Workflow editor and runtime
Ollama
Local LLM runtime used by demo workflows
Example terminal output (truncated)
Cloning into 'self-hosted-ai-starter-kit'...remote: Enumerating objects: 161, done.Receiving objects: 100% (151/151), 9.92 MiB | 4.35 MiB/s, done.Resolving deltas: 100% (26/26), done.marconi@Marconi-MacBook-Pro % cd self-hosted-ai-starter-kitmarconi@Marconi-MacBook-Pro self-hosted-ai-starter-kit % cp .env.example .envmarconi@Marconi-MacBook-Pro self-hosted-ai-starter-kit % docker compose --profile cpu up[+] Running 98/41 ✔ postgres Pulled ... ✔ qdrant Pulled ... ✔ n8n Pulled ... ✔ ollama Pulled ......ollama time=2025-08-26T08:24:08.451Z level=INFO source=logs:130 msg="inference compute" id=0 library=cpu total="7.7 GiB" available="6.8 GiB"postgres-1 2025-08-26 08:24:08.422 UTC [1] LOG: starting PostgreSQL 16 on aarch64-unknown-linux-musldrant 2025-08-26T08:24:08.444UTC INFO drant: 1x unit API Listening on 6333n8n-import Successfully imported 2 credentials.n8n-import Successfully imported 1 workflow.n8n Initializing...n8n Editor is now accessible via:
On first visit you will be prompted to create an owner account (email, name, password). Any local email works for this self-hosted setup.
Demo workflow and Ollama integration
The starter kit automatically imports a demo workflow when n8n starts.
Open the demo workflow in the editor: it demonstrates a simple LLM chain using an Ollama chat model.
Create an Ollama credential in n8n and point it to your Ollama host. When using the compose stack, the default is ollama:11434 (Docker-internal hostname mapped to localhost:11434 on the host machine).
Send a sample prompt (for example, “Hey, how’s it going?”) to test the node. Responses should come from the local Ollama instance running in the compose stack.
Inspecting Docker Desktop
Use Docker Desktop to view containers, images, networks, and volumes created by the starter kit.
Stopping the compose stack (or containers) will disconnect n8n from Ollama and other services because they run in the same compose network.
Volumes hold Postgres and Ollama state; manage them via Docker Desktop if you need to clear or backup data.
Compose configuration (example)
If you need to change ports, credentials, environment variables, or persistent volumes, edit the repository’s docker-compose files. Below is an illustrative excerpt showing volumes, network, and the n8n & Ollama service definitions — update .env values as appropriate.
Do not commit your .env file to source control. The file contains sensitive values (database passwords, encryption keys, JWT secrets). Use secure storage or environment-specific secrets for production deployments.
This starter kit runs n8n, Ollama, Postgres, and Qdrant locally using Docker Desktop, enabling full local development and testing of AI-driven workflows.
For production-grade deployments, evaluate network security, backups for volumes, and using managed database or vector stores as needed.
That’s it — you’re ready to build and test n8n workflows locally with a local Ollama LLM.