Skip to content

Commit cd6b467

Browse files
committed
Extend ollama connection on linux, extend docs for integration
1 parent 6cf981b commit cd6b467

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

docs/llm.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,66 @@ Other agents do not yet have LLM mapping and will not receive any LLM configurat
1919
ollama pull qwen3:14b
2020
```
2121

22+
!!! note "Linux: expose Ollama to Docker"
23+
On Linux, Ollama binds to `127.0.0.1` by default. Docker containers reach the host via the Docker bridge gateway (for example `172.17.0.1` on the default Docker bridge), so the default binding will refuse connections.
24+
25+
**If running Ollama manually:**
26+
27+
```bash
28+
OLLAMA_HOST=0.0.0.0 ollama serve
29+
```
30+
31+
**If running Ollama as a systemd service** (the recommended Linux install), create an override:
32+
33+
```bash
34+
sudo systemctl edit ollama
35+
```
36+
37+
Add the following and save:
38+
39+
```ini
40+
[Service]
41+
Environment="OLLAMA_HOST=0.0.0.0"
42+
```
43+
44+
Then reload and restart:
45+
46+
```bash
47+
sudo systemctl daemon-reload
48+
sudo systemctl restart ollama
49+
```
50+
51+
Verify it is listening on all interfaces:
52+
53+
```bash
54+
sudo ss -tlnp | grep 11434
55+
# Should show 0.0.0.0:11434, not 127.0.0.1:11434
56+
# (sudo is required for -p to display process names; omit sudo or drop -p to just check the port)
57+
```
58+
59+
!!! warning "Security: binding to `0.0.0.0` exposes Ollama on all interfaces"
60+
Setting `OLLAMA_HOST=0.0.0.0` makes Ollama reachable on **every** network
61+
interface of the host, including public-facing ones. Only do this on trusted
62+
networks or when the host is protected by a firewall.
63+
64+
**Safer alternatives:**
65+
66+
- **Bind to the Docker bridge gateway only** (e.g., `OLLAMA_HOST=172.17.0.1`)
67+
so only containers on the default Docker bridge can reach Ollama while the
68+
service remains unreachable from other interfaces. Substitute the actual
69+
gateway IP reported by `docker network inspect bridge`.
70+
- **Restrict access at the network level** with firewall rules (e.g.,
71+
`ufw` or `iptables`) that allow port `11434` only from the Docker bridge
72+
subnet before widening the bind address.
73+
- **Add authentication** before exposing the service beyond localhost.
74+
`OLLAMA_ORIGINS` controls which origins may make cross-origin (CORS)
75+
requests to Ollama — it is **not** an authentication mechanism. The
76+
local Ollama server has no built-in auth; API-key support is only
77+
available for Ollama's cloud API. To protect a locally-exposed
78+
instance, place a reverse proxy (e.g., nginx or Traefik) with proper
79+
authentication in front of it, or enforce access via network ACLs /
80+
firewall rules.
81+
2282
### 2. Configure VibePod
2383

2484
Add the following to your global or project config:

src/vibepod/core/docker.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ def ensure_proxy(self, image: str, db_path: Path, ca_dir: Path, network: str) ->
319319
},
320320
"volumes": volumes,
321321
"network": network,
322+
"extra_hosts": {"host.docker.internal": "host-gateway"},
322323
}
323324

324325
getuid = getattr(os, "getuid", None)

tests/test_proxy_permissions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,6 @@ def __init__(self) -> None:
8484
assert run_kwargs is not None
8585
assert run_kwargs["user"] == "1234:2345"
8686
assert "ports" not in run_kwargs
87+
assert run_kwargs["extra_hosts"] == {"host.docker.internal": "host-gateway"}
8788
assert db_path.parent.exists()
8889
assert ca_dir.exists()

0 commit comments

Comments
 (0)