Skip to content

How-ToGPU

How to Self-Host Dify With Ollama on Your PC for Private AI Apps

Dify lets you build private chatbots, document assistants and AI workflows without code. We show how to run it on your PC with Docker, connect it to Ollama for local models, fix the localhost trap and add an embedding model.

By , Systems & Technical Editor

5 min read

How to Self-Host Dify With Ollama on Your PC for Private AI Apps

These steps follow Dify's official Docker Compose guide, the README for Dify's official Ollama plugin and Ollama's FAQ, all read on 3 December 2026. Menu names and settings may change between releases.

Dify is an open-source platform for building AI apps: chatbots, document question-answering (RAG), agents and multi-step workflows, all assembled in a web interface rather than in code. Most people meet it through Dify Cloud, but the Community Edition runs on your own PC with Docker. Pair it with Ollama and the language model runs on your own graphics card too, so prompts and documents don't have to leave your machine.

This guide covers installing Dify, connecting it to Ollama, and the one networking step that trips most people up.

What you need

Dify's documentation lists a minimum of a 2-core CPU and 4GiB of RAM for the Dify services themselves. That figure doesn't include the language model. Ollama runs the model on your graphics card's VRAM where it can, spilling into slower system RAM when it doesn't fit, so plan your hardware around the model you want to run. Our guides to how much VRAM you need and how much RAM you need for local AI give the sizing rules. A 16GB card such as the ASUS RTX 5060 Ti 16GB Dual OC gives room for mid-sized models alongside an embedding model.

Software-wise, Dify asks for:

  • Docker with Docker Compose 2.35.0 or later, with the Docker daemon running

  • Git, to download Dify

  • OpenSSL, to generate a token for Dify's agent sandbox

On Windows, Dify's guide says to use Docker Desktop with WSL 2 and to store the source code and container data in the Linux file system rather than on a Windows drive. On a Mac, it says to give Docker Desktop's virtual machine at least 2 virtual CPUs and 8GiB of memory. On Linux, install Docker Engine and the Compose plugin for your distribution.

Check your Compose version first:

docker compose version

Step 1: Install Ollama and pull a model

Install Ollama from ollama.com/download, then pull a chat model and, if you plan to use document search, an embedding model. Dify's Ollama plugin README uses these examples:

ollama run gemma3
ollama pull qwen3
ollama pull embeddinggemma

Ollama's local API then listens at http://localhost:11434. If you have a graphics card, it's worth confirming Ollama is actually using it; see how to check Ollama is using your GPU.

Step 2: Download and configure Dify

Dify's guide tells you to pick a version from Dify's releases page and clone that tag. At the time of writing the latest release listed on GitHub is 1.20.0, published on 18 November 2026. Replace <version> with the tag you choose:

git clone --branch <version> --depth 1 https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
openssl rand -hex 32

Open .env in a text editor and set DIFY_AGENT_LOCAL_SANDBOX_AUTH_TOKEN to the string the openssl command printed. Dify's guide says the agent backend and its local sandbox need this shared token to start.

Step 3: Start Dify

From the dify/docker folder, run:

docker compose up -d
docker compose ps --all

Long-running services should show Up or healthy. A one-off task called init_permissions should show Exited (0), which Dify says is expected. The Compose deployment includes PostgreSQL, the Weaviate vector database and the other services Dify needs, so you don't have to set up a database yourself.

Open http://localhost/install in your browser, create the administrator account, then sign in at http://localhost. Dify uses port 80 by default. If something else on your PC already uses port 80, set EXPOSE_NGINX_PORT in docker/.env to another port and add it to the address, for example http://localhost:8080.

Step 4: Let Dify's containers reach Ollama

This is where most set-ups go wrong. Inside a Docker container, localhost means the container itself, not your PC, so a Base URL of http://localhost:11434 won't reach Ollama running on the host.

Dify's Ollama plugin README says Docker deployments should use a host address the Dify container can reach, such as http://host.docker.internal:11434 or your PC's LAN IP address.

Ollama's FAQ adds that Ollama binds to 127.0.0.1 on port 11434 by default, and that you change this with the OLLAMA_HOST environment variable. If Dify can't connect, set OLLAMA_HOST so Ollama listens on an address the containers can reach, then restart Ollama. Our guide to setting Ollama environment variables on Windows shows where to do it. Only make Ollama reachable beyond your own PC on a network you trust.

Step 5: Install the Ollama plugin and add models

In Dify, open the Marketplace, install the Ollama plugin, then go to Settings > Model Providers > Ollama and add a model. The plugin README describes these fields:

  • Model Name: the Ollama model name, for example gemma3 or qwen3

  • Base URL: the host root, such as http://host.docker.internal:11434. Don't add /api; the plugin adds the endpoint paths itself

  • API Key: optional for a local Ollama

  • Model Type: Chat for chat, tool calling and vision

  • Model Context Length: match the model's context window

  • Vision support and Function call support: choose Yes only if the model supports images or tools

Add your embedding model the same way with the model type set to Text Embedding. Dify uses it to index documents for its knowledge base. Our best local embedding models guide helps you choose one.

A larger context length uses more VRAM, so don't set it higher than you need. Our guide to setting Ollama's context length explains the trade-off.

Step 6: Build your first app

In Dify you can create a chatbot, an agent or a workflow and pick your Ollama model in its settings. A simple first project is a private document assistant: create a knowledge base, upload PDFs, let Dify index them with your local embedding model, then attach the knowledge base to a chatbot.

The plugin README also says it supports streamed responses, thinking output, tool calling and vision, so reasoning and multimodal models from Ollama work in Dify apps as long as you tick the matching options when adding them.

Before you let anyone else in

Dify's guide warns that the bundled credentials are for development. Before other people can reach the deployment, it says to configure HTTPS and replace the default database, Redis, sandbox and Weaviate secrets in docker/.env. For a single-user set-up on your own PC this matters less, but don't expose it to the internet as-is.

The bottom line

Dify turns Ollama into a platform for building private chatbots, document assistants and workflows without code. Install Docker and Ollama, clone a Dify release, set the sandbox token in .env and run docker compose up -d. The key step is pointing Dify's Ollama plugin at http://host.docker.internal:11434 rather than localhost, and making Ollama listen where the containers can reach it. Size your GPU and RAM for the model, not for Dify, which needs only 2 cores and 4GiB.

In this article

Sources

  1. 01Dify docs, Deploy Dify with Docker Compose
  2. 02Dify on GitHub (README)
  3. 03Dify on GitHub, Releases
  4. 04Dify official plugins on GitHub, Ollama plugin README
  5. 05Ollama docs, FAQ

About the author

Marcus Thorne

Systems & Technical Editor

Marcus writes Forge PC's step-by-step build, troubleshooting and system optimisation guides. His background spans Windows kernel and power-state diagnostics, UEFI/BIOS configuration, NVMe storage arrays, ATX 3.1 power delivery and running local AI and LLM workloads on consumer graphics cards.

More from Marcus Thorne

Read next

Best Free Android Screen Mirroring Apps for PC (2026)

Best Picks

Best Free Android Screen Mirroring Apps for PC (2026)

The best free apps to mirror and control your Android phone on a PC in 2026: scrcpy for almost any phone, Phone Link on supported models, Escrcpy and QtScrcpy for a graphical interface, and Vysor for browser and iPhone support.

Hannah Vance6 min

scrcpy vs Phone Link: Best Way to Use Android Apps on a PC?

Versus

scrcpy vs Phone Link: Best Way to Use Android Apps on a PC?

scrcpy and Microsoft Phone Link both put your Android phone's apps on a Windows PC for free. We compare phone support, setup, how each shows your apps, extra features and privacy to help you pick the right one.

Callum Reid5 min

How to Mirror and Control Your Android Phone on a PC with scrcpy

How-To

How to Mirror and Control Your Android Phone on a PC with scrcpy

scrcpy is a free, open-source app that mirrors your Android phone's screen and sound on a Windows PC and lets you control it with your mouse and keyboard. We show how to enable USB debugging, install it, connect over USB or Wi-Fi, use the best shortcuts and options, and fix common errors.

Marcus Thorne7 min