Serving Ollama Beyond Localhost

Harry · 13 Sep 2026 · 2 views

Expose the API

Ollama listens only on localhost by default. Set OLLAMA_HOST to reach it from other machines.

export OLLAMA_HOST=0.0.0.0:11434   # macOS / Linux
setx OLLAMA_HOST "0.0.0.0:11434"    # Windows (then restart Ollama)

Clients can now call http://your-server:11434 from the local network.

Run in Docker

docker run -d -v ollama:/root/.ollama -p 11434:11434 
  --name ollama ollama/ollama

The volume keeps models across container restarts.

GPU in Docker (Linux)

docker run -d --gpus=all -v ollama:/root/.ollama 
  -p 11434:11434 --name ollama ollama/ollama

Security

Once exposed, the API has no built-in authentication. Put TLS and auth in front of it, and never expose the port to the public internet directly.

Key Points

  • OLLAMA_HOST controls which addresses Ollama binds.
  • Docker containers make the model store portable.
  • Add --gpus=all on GPU servers.
  • Protect exposed instances with TLS and auth.
Share this post:

Comments (0)

Please login or register to comment.