ollama-docker-compose

Minimal Docker Compose setup for running Ollama locally — exposes the API on :11434 with a named volume so pulled models persist across restarts.

The "optionally with a web UI" phrase from the description is not yet wired. Open Web UI sidecar can be added — see Roadmap.

Quick start

docker compose up -d

Ollama API → http://localhost:11434.

Pull a model:

docker compose exec ollama ollama pull llama3.2

Chat from CLI:

docker compose exec ollama ollama run llama3.2

Smoke test via API:

curl http://localhost:11434/api/generate -d '{
  "model": "llama3.2",
  "prompt": "Why is the sky blue?",
  "stream": false
}'

What's inside

Field Value
Image ollama/ollama (latest)
Port 11434:11434
Volume ollama:/root/.ollama (models, manifests)
Restart policy unless-stopped

GPU

To enable GPU, add deploy.resources.reservations.devices for the NVIDIA runtime — see the Ollama Docker docs. CPU-only by default.

Roadmap

  • Add Open Web UI sidecar (ghcr.io/open-webui/open-webui:main) on :3000 wired to this Ollama instance.

License

Apache-2.0

S
Description
No description provided
Readme Apache-2.0 87 KiB