I run Ollama and Open WebUI on my homelab so I can use AI models on my own hardware: no monthly subscription, no rate limits, and nothing I type leaves my network. Ollama downloads and runs the models, and Open WebUI gives you a ChatGPT-style page in the browser that everyone on your network can use. This is a simple Docker setup that starts on CPU and adds a GPU later.
Quick answer
Install Docker, save the Compose file below, and run docker compose up -d. Pull a model with docker exec -it ollama ollama pull gemma3:4b, open http://SERVER-IP:3000, and create the first account, which becomes the admin. Keep Ollama's port 11434 private and add a GPU only once the basic stack works.
If you just want to try Ollama on your own Windows or Mac computer, without a server, start with my simpler guide: run AI models on your own computer with Ollama.
What you need
| Part | Minimum | What I would use |
|---|---|---|
| CPU | Any modern 4-core x86 or ARM64 | 6 cores or more |
| RAM | 8 GB for small 3B to 4B models | 16 to 32 GB |
| Disk | 30 GB free | An SSD with 100 GB or more, because models add up fast |
| GPU | Not required | NVIDIA with 8 GB VRAM or more for real speed |
| Software | Linux with Docker Engine and the Compose plugin | Ubuntu Server LTS or Debian |
A Proxmox VM or LXC container works fine too. If you are building the server from scratch, see installing Proxmox VE and my list of homelab services worth running.
Step 1: Create the Compose stack
mkdir -p ~/homelab/ollama && cd ~/homelab/ollama
Save this as compose.yaml:
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
volumes:
- ollama:/root/.ollama
environment:
- OLLAMA_KEEP_ALIVE=30m
open-webui:
image: ghcr.io/open-webui/open-webui:main
container_name: open-webui
restart: unless-stopped
depends_on:
- ollama
ports:
- "3000:8080"
environment:
- OLLAMA_BASE_URL=http://ollama:11434
volumes:
- open-webui:/app/backend/data
volumes:
ollama:
open-webui:
Two things worth knowing about this file:
- Port 11434 is not published. Open WebUI talks to Ollama over Docker's internal network, so Ollama's API is not open to your whole LAN. Ollama has no login of its own, so this matters.
- Both volumes keep your data.
ollamaholds the models andopen-webuiholds accounts, chats and settings. Recreating the containers does not touch them; deleting the volumes does.
Step 2: Start it and pull a model
docker compose up -d
docker compose ps
docker exec -it ollama ollama pull gemma3:4b
docker exec ollama ollama list
Which model to start with depends on your memory. These are good starting points; check the Ollama library for newer releases.
| Model | Download size (approx.) | Good for | Needs |
|---|---|---|---|
| gemma3:4b | 3 GB | Everyday questions, summaries | 8 GB RAM |
| qwen3:8b | 5 GB | Better reasoning, coding help | 16 GB RAM or an 8 GB GPU |
| gpt-oss:20b | 14 GB | Close to cloud quality for many tasks | 32 GB RAM or a 16 GB GPU |
The tag after the colon is the size. Smaller tags use quantized weights, which is why an 8B model fits in about 5 GB. Start small, watch memory with free -h, and step up only when the server is comfortable.
Step 3: Open Open WebUI and create the admin account
Browse to http://SERVER-IP:3000. The first account you create becomes the administrator, so do this straight away, before anyone else on the network finds the page. Then pick the model from the dropdown at the top of the chat.
If Open WebUI cannot see your models, check the connection under Admin Panel > Settings > Connections. The Ollama URL must be http://ollama:11434. Do not use localhost: inside the Open WebUI container, localhost is the container itself.
Step 4: Add an NVIDIA GPU (optional)
On CPU, a 4B model gives a few words per second, which is usable but slow. A GPU makes it feel instant. Get the basic stack working first, then:
- Install the NVIDIA driver on the host and check it with
nvidia-smi. - Add NVIDIA's package repository, then install the toolkit and connect it to Docker:
sudo apt install -y nvidia-container-toolkit
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
- Change the
ollamaservice incompose.yamlto this and recreate it:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
volumes:
- ollama:/root/.ollama
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
docker compose up -d --force-recreate ollama
docker exec ollama ollama ps
While a model is answering, ollama ps should show it running on the GPU. AMD cards need the ollama/ollama:rocm image and the /dev/kfd and /dev/dri devices instead.
Step 5: Lock it down
- Do not port-forward 3000 to the internet. To use it away from home, connect through a VPN such as WireGuard or Tailscale, or put it behind a reverse proxy with HTTPS.
- Turn off open sign-ups after creating your accounts, under Admin Panel > Settings > General, or set new users to pending so you approve them.
- Behind a reverse proxy, enable WebSocket support, or answers will not stream.
- Watch Docker and UFW. Docker publishes ports around UFW rules, so test from another device that port 3000 is only reachable where you expect.
Step 6: Updates and backups
# update both containers
docker compose pull && docker compose up -d
# back up Open WebUI data (accounts, chats, settings)
docker compose stop open-webui
docker run --rm -v ollama_open-webui:/data:ro -v "$PWD":/backup alpine \
tar czf /backup/open-webui-$(date +%F).tgz -C /data .
docker compose start open-webui
Compose usually prefixes volume names with the folder name, so check the real name with docker volume ls first. Back up the Open WebUI volume regularly; the models can always be pulled again, but chats and users cannot.
Troubleshooting
| Problem | Fix |
|---|---|
| Page at port 3000 does not load | Run docker compose ps and docker compose logs open-webui. Check the firewall and that nothing else uses port 3000. |
| No models in the dropdown | Set the Ollama URL to http://ollama:11434 and pull at least one model. |
| Out of memory, or the model unloads | Use a smaller model or tag, and close other models. ollama ps shows what is loaded. |
| Answers are very slow | You are on CPU, or the GPU is not used. Check ollama ps and nvidia-smi while it answers. |
| Streaming stops behind a proxy | Enable WebSockets and raise the proxy timeout. |
Where to go next
- Upload PDFs and notes into Open WebUI's Knowledge section and ask questions about them.
- Point other tools, such as n8n or Home Assistant, at Ollama's API. Publish port 11434 only on a trusted network if you do.
- Read AI agents explained to see how local models fit into automated workflows.
Frequently asked questions
Can I run Ollama and Open WebUI without a GPU?
Yes. Everything works on CPU. Small models such as gemma3:4b are usable on a modern CPU with 8 GB of RAM, but answers come slower than with a GPU.
How much RAM do I need for a local LLM?
About 8 GB for a 3B to 4B model, 16 GB for a 7B to 8B model, and 32 GB or a 16 GB GPU for a 20B model. Leave some memory for the operating system and other containers.
Should I expose Ollama port 11434?
Usually not. Ollama has no authentication, so anyone who can reach the port can use it. Open WebUI reaches it over Docker's internal network, which is all most setups need.
Where are my models and chats stored?
Models are in the ollama volume and Open WebUI data is in the open-webui volume. Back up the Open WebUI volume regularly; models can be downloaded again.
Is Open WebUI safe to use on my network?
Yes, if you create the admin account immediately, turn off open sign-ups, and do not expose it directly to the internet. Use a VPN for remote access.