A Docker configuration for building an Ollama server exposed to a Tailnet.
-
Set up your Tailscale Auth Key
- Obtain a Tailscale auth key.
- Create a
.envfile in this directory with:TS_AUTHKEY=tskey-xxxxxxxxxxxxxxxx OLLAMA_HOSTNAME=ollama-server OLLAMA_URL=https://ollama-server.host.com - Replace
tskey-xxxxxxxxxxxxxxxxwith your actual Tailscale auth key. - Replace
ollama-serverwith the desired hostname for your Ollama server via Tailscale. - Replace
https://ollama-server.host.comwith the URL you want to use for accessing the Ollama server.
-
Update the Caddyfile
- Ensure the
Caddyfileis configured to use the hostname specified in your.envfile. The default configuration should work if you setOLLAMA_HOSTNAME=ollama-server.
- Ensure the
-
Build the Docker image
docker-compose build
-
Run the Docker container
docker-compose up -d
-
Access the Ollama server
- Open your web browser and navigate to
http://ollama-server:11434or use the hostname you specified in the.envfile.
- Open your web browser and navigate to
-
Stop the Docker container
docker-compose down