Every cloud AI service reads your data, charges monthly, and goes down when their servers do. This setup runs on your machine. No subscription, no data sent anywhere, no uptime dependency on someone else's infrastructure.
The stack: OpenClaw for the agent framework, Ollama to run local models, Docker to package it all.
flowchart LR BR[Browser] -->|localhost| OC[OpenClaw\nin Docker] OC -->|host.docker.internal:11434| OL[Ollama] OL --> LM[Local model\ngpt-oss:20b] LM -->|response| OC OC -->|reply| BR
What you're building
A fully functional OpenClaw instance running on Docker on your local machine. The AI model runs in Ollama, also locally. OpenClaw connects to Ollama through Docker's internal network. You get a working AI agent accessible from your browser with zero cloud dependencies.
Prerequisites
- A machine with enough RAM for the model (8 GB minimum; 16+ GB recommended)
- Docker Desktop installed
- Git
Step 1: Install Ollama
Go to ollama.com/download and copy the install command for your OS. Run it in the terminal.
Verify the install:
ollama --version
Step 2: Pull a local model
ollama pull gpt-oss:20b
Or any other model from the Ollama library. Download time depends on model size and your connection.
Verify the download:
ollama list
The model name appears in the list. That's all you need from Ollama for now.
Step 3: Install Docker Desktop
Download Docker Desktop from docker.com. Install and open it. The whale icon in your menu bar means Docker is running. Keep it open — Docker needs to be running for the containers to work.
Step 4: Clone and build OpenClaw
git clone https://github.com/openclaw/openclaw.git
cd openclaw
./setup-docker.sh
The build takes several minutes. It pulls the OpenClaw image, installs dependencies, and starts the initial configuration wizard.
Before the wizard starts, scroll up in the terminal and copy the gateway token. It appears during the build output and you'll need it during setup. Save it somewhere.
Step 5: Run the setup wizard
Walk through the configuration:
- Security warning: yes (required)
- Onboarding mode: select Manual (not Quick Start)
- What to set up: Local Gateway (this machine)
- Workspace: leave default
- Model health provider: OpenAI (temporary — you'll replace this with Ollama in the next step)
- API key: paste any value, it won't be used.
123works. - Default model: keep current (same reason — you'll override it)
- Gateway port: leave default
- Gateway bind: select LAN gateway
- Gateway token: paste the token you copied from the build output
- Tailscale exposure: off
- Shell completion: no
Skip all remaining steps (channels, skills, API keys). The wizard finishes. Docker Desktop shows an OpenClaw container running.
Step 6: Reconfigure OpenClaw to use Ollama
The initial setup pointed OpenClaw at OpenAI. You need to redirect it to Ollama.
First, stop the containers:
docker compose down
Open the config file at openclaw/openclaw.json. Find the model providers section and update it:
"model_providers": {
"ollama": {
"base_url": "http://host.docker.internal:11434",
"api_key": "any_value",
"api": "ollama",
"model": "gpt-oss:20b"
}
}
The host.docker.internal address is critical. Using localhost won't work from inside the container. host.docker.internal routes from the container to the host machine where Ollama is running.
Find the agents section and update the default model to ollama:
"agents": {
"main": {
"brain": "ollama"
}
}
Verify the gateway token in the config matches what you saved earlier. If it doesn't match, update it.
Save the file.
Step 7: Restart and access the dashboard
docker compose up
Wait for the container to start. Scroll through the logs until you see the dashboard URL — it includes the token as a query parameter. Copy it and open it in your browser.
If there's a "pairing required" error, fix it from a new terminal:
docker exec -it openclaw openclaw devices list
Copy the pending request ID. Then:
docker exec -it openclaw openclaw devices approve REQUEST_ID
Refresh the dashboard. The error clears.
Step 8: Test it
In the OpenClaw chat: "Hi." The agent responds using the local Ollama model. No internet request goes out. No data leaves your machine.
What you gain
- No monthly subscription
- No data tracking
- Works offline
- The model runs as fast as your local hardware allows
The tradeoff: smaller free models aren't as capable as GPT-4 or Claude 3.5 Sonnet. For tasks like summarizing documents, drafting text, or answering questions from a knowledge base, they work well. For complex reasoning tasks, you'll feel the difference.
If you want a production-grade private AI setup for your team or organization, get in touch or explore our AI consulting service.