Skip to main content
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.
The image shows a GitHub repository for a "Self-hosted AI Starter Kit" by n8n, featuring various files and an overview of the project's purpose. It includes sections for code, pull requests, discussions, and other repository details.
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.
  • Open n8n at http://localhost:5678 and create an owner account.
  • Inspect and run the demo workflow that uses a local Ollama model.
Prerequisites
The image shows the Docker website with an emphasis on downloading Docker Desktop for different platforms, including Mac (Apple Silicon and Intel) and Windows (AMD64). It also includes navigation options and a banner about building AI agents.
Step 1 — Clone the repo and create your .env
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. Example:
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 Example terminal output (truncated)
Step 3 — Open n8n in your browser
  • Go to: http://localhost:5678
  • On first visit you will be prompted to create an owner account (email, name, password). Any local email works for this self-hosted setup.
The image shows a web page with a form for setting up an owner account, requiring email, first name, last name, and password. There is also an option to receive security and product updates.
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.
The image shows a workflow interface in a software application, featuring a chat trigger connected to two models (Ollama Chat Model and Ollama Model) through a basic LLM chain. There is a chat log at the bottom displaying an interaction with the system.
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.
The image shows the Docker Desktop interface, focused on the "Volumes" section, displaying a list of available self-hosted AI starter kit storage volumes with options to manage them. There is also a section for walkthroughs at the bottom of the screen.
The image shows the Docker Desktop application with a list of running containers, displaying details like container name, ID, image, ports, CPU usage, and actions available.
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.
References and further reading Wrap-up
  • 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.

Watch Video