If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.
This add-on installs Ollama inside the web container of your DDEV project, so local models are available to your code with no extra setup.
The ollama command works in ddev ssh and ddev exec, and the Ollama API answers on http://localhost:11434 inside the web container. Models are downloaded once per machine and shared by every project that uses this add-on.
ddev add-on get brookemahoney/ddev-assistant-ollama
ddev restart
After installation, make sure to commit the .ddev directory to version control.
| Command | Description |
|---|---|
ddev exec ollama run <model> |
Run a model, downloading it first if needed |
ddev exec ollama list |
List downloaded models |
ddev exec ddev-ollama-start |
Start the server, if it is not already running |
ddev describe |
View the Ollama endpoint in the service table |
From inside the web container, the API is at http://localhost:11434, or http://web:11434 from another container in the same project:
ddev exec ollama run llama3.2
ddev exec curl -s http://localhost:11434/api/version
The add-on sets two environment variables, and only as defaults, so a project can override either of them with web_environment in .ddev/config.local.yaml:
| Variable | Default | Description |
|---|---|---|
OLLAMA_HOST |
0.0.0.0:11434 |
Where the server listens. Point it at a non-local address, such as host.docker.internal:11434, to use an Ollama that already runs on the host; the add-on then does not start a server of its own. |
OLLAMA_MODELS |
/mnt/ddev-global-cache/assistant-ollama/models |
Where models are stored. The DDEV global cache is per machine, so a model is downloaded once for all projects. |
# .ddev/config.local.yaml
web_environment:
- OLLAMA_HOST=127.0.0.1:11435
Server logs are in /tmp/ollama.log inside the web container:
ddev exec tail -f /tmp/ollama.log
The port is not published by default, because the server is meant for the web container. To reach it from the host as well, publish it on the web service:
# .ddev/docker-compose.web-ports.yaml
services:
web:
ports:
- "11434"
ddev describe then shows the host port to use.
/usr/local/bin/ollama, with its runtime in /usr/local/lib/ollama, so it is on $PATH in every shell type and survives ddev restart without a per-start copypost-start hook that waits until the API answers, so Ollama is usable as soon as ddev start returns. The hook is idempotent, and it fails loudly rather than leaving you with no serverddev restart, ddev rm and ddev add-on removealpine/ollama image, which carries the CPU-only runtime in 68 MB rather than the ~1.5 GB of the official Linux release, most of which is GPU libraries. It tracks Ollama releases a week or two behind; ddev exec ollama --version shows the installed version.ddev add-on remove brookemahoney/ddev-assistant-ollama removes the add-on’s files, and the next ddev restart rebuilds the web image without Ollama. Downloaded models stay in the global cache; remove them with ddev exec sudo rm -rf /mnt/ddev-global-cache/assistant-ollama.Contributed and maintained by @brookemahoney
If you find this add-on useful, please star it on GitHub — stars show appreciation and help maintainers know their work matters.