How to self-host n8n with Docker and connect Ollama on Windows

You will run n8n in a Docker container on your own Windows PC and connect it to a free local AI model, llama3.2, through Ollama. It suits beginners who want to build and test AI workflows without paying for n8n Cloud or an API key. Your computer must stay on while it runs.

YouTube video: How I Self-Host n8n With Docker and Run AI on It for $0 (Ollama)

YouTube’s video details do not confirm captions. Check CC in the player for available tracks.

23 chapters. Tap a step to jump to it.Chapters from the creator
Choose a chapter (23)
Video length
14 min 27 s
Time to do it
45 minutes
Difficulty
Medium
Steps
9

What you need

Steps

  1. Install Docker Desktop and start it. Wait until the engine shows as running before you continue.

  2. Open PowerShell and check the install by typing docker --version. You should see a version number.

  3. Create a volume so your workflows survive restarts: docker volume create n8n_data.

  4. Start n8n with docker run, mounting the n8n_data volume and publishing port 5678. Allow it through the firewall prompt if Windows asks.

  5. Open localhost:5678 in your browser, create your owner account, then enter a free community licence key.

  6. Install Ollama from PowerShell, then download the model with ollama pull llama3.2.

  7. Test the model in the terminal to confirm it replies before you connect it to n8n.

  8. In n8n, add an Ollama credential. Set the base URL to host.docker.internal, not localhost, because n8n runs inside the container.

  9. Build a workflow with a Message a model node, run it, and read the reply from your own machine.

Tips and common mistakes

Use host.docker.internal for the Ollama URL, or n8n cannot reach the model on your PC.

This setup only runs while your computer is on, so use it for practice and testing, not live production.

Keep the n8n_data volume, or your workflows will be lost when the container restarts.

Questions

Do I need an API key or a paid plan?

No. You use the free n8n community licence key and a local Ollama model, so there are no API costs.

Why does localhost not work in the Ollama credential?

Inside the Docker container, localhost means the container itself. Use host.docker.internal to point back to your Windows machine.

Can I use this for a live business workflow?

Not reliably. It stops when your computer shuts down, so use a server or VPS for production.

The notes are drafted automatically from video details and general task knowledge. How the guide was prepared

Report a correction

More in Computers & Phones

See all