Connecting openweb-ui to ollama

I’m running Ollama as a service on Ubuntu 24.04, and after starting openweb-ui as a Docker container with:

docker run -d -p 3000:8080 --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --runtime=nvidia --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda

I’m unable to select a model in the ui and seeing this connect error in the container logs:

open_webui.routers.ollama:send_get_request:92 - Connection error: Cannot connect to host host.docker.internal:11434 ssl:default [Domain name not found

After reviewing the logs with Claude, it pointed out that Ollama was crash looping with an error attempting to open port 11434, and suggested that my updates in /etc/systemd/system/ollama.service to attempt to fix this issue were on the right track but attempting to add the OLLAMA_HOST env with a port to the same line defining the PATH results in an incorrect concat of the values:

Environment="OLLAMA_HOST=0.0.0.0:11434:PATH=/usr/local/sbin:..."

This needs to be split into 2 lines:

Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="PATH=/usr/local/sbin:..."

-Reload the service config and restart with:

sudo systemctl daemon-reload
sudo systemctl restart ollama

It also recommended to change the Ollama URL in the Connection settings in openweb-ui to 127.0.0.1:11434 and now open-ui is working as expected.