Skip to content

Instantly share code, notes, and snippets.

@yucer
Last active August 28, 2025 22:08
Show Gist options
  • Select an option

  • Save yucer/70d3e48cc08d96d8c31b79655e481e07 to your computer and use it in GitHub Desktop.

Select an option

Save yucer/70d3e48cc08d96d8c31b79655e481e07 to your computer and use it in GitHub Desktop.
ollama (cpu) + open-webui
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
gpus: all
environment:
- TERM=dumb
- NO_COLOR=1 # some CLIs respect this
- CI=1 # some CLIs simplify output in CI
# - OLLAMA_NUM_GPU=0 # force CPU
# - OLLAMA_KEEP_ALIVE=5m # opcional, evita apagar el modelo enseguida
volumes:
- "ollama-models:/root/.ollama"
healthcheck:
test: ["CMD", "ollama", "list"]
interval: 10s
timeout: 3s
retries: 20
start_period: 10s
restart: unless-stopped
# One-shot job that pulls the preferred models once Ollama is up
ollama-init:
image: ollama/ollama:latest
depends_on:
ollama:
condition: service_healthy
environment:
- OLLAMA_HOST=http://ollama:11434
entrypoint:
- /bin/bash
- -c
- |
set -e
echo "Pulling prefered for Ollama models …"
for m in \
gemma:2b \
codellama:7b \
codegemma:7b \
deepseek-coder:1.3b \
deepseek-coder:6.7b \
deepseek-coder-v2:16b \
llama3:8b \
codellama:13b \
codestral:latest \
gpt-oss:latest
do
echo "Pulling $$m …"
ollama pull "$$m"
done
echo "All done."
restart: "no"
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
ports:
- "3000:8080" # WebUI accesible in http://localhost:3000
environment:
- OLLAMA_BASE_URL=http://ollama:11434
depends_on:
- ollama
restart: unless-stopped
volumes:
- "open-webui-data:/app/backend/data"
volumes:
ollama-models:
# external: true
driver: local
driver_opts:
type: none
o: bind
device: $HOME/.ollama
open-webui-data:
external: true
@yucer
Copy link
Author

yucer commented Aug 25, 2025

it needs the external volumes to be created first:

docker volume create ollama-models   # only if marked as external

docker volume create open-webui-data

@yucer
Copy link
Author

yucer commented Aug 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment