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.

Installing docker via snap on Ubuntu gets permission denied unix:///var/run/docker.sock error

If you follow a ‘normal’ install of docker via the install guide, you add yourself to the docker group to get permissions as a normal user to run the docker commands. If you install on Ubuntu with snap however, you still get error:

permission denied while trying to connect to the docker API at unix:///var/run/docker.sock

Per this post, you need to run this to give yourself permissions:

sudo setfacl --modify user:[your-user-id]:rw /var/run/docker.sock

Ollama: Increase context for a model to use with Opencode

by default, ollama sets a very low context size with any model it launches. To change this, set the num_ctx parameter on a model and save it as a new model:

ollama run modelname:12b

/set parameter num_ctx 32768

/save modelname:12b-32k

Update .ollama/config.json to include the new model.

Start new model with ‘ollama launch opencode’ pick newly configured model from the list

You get what you measure – be careful what you incentivise

I worked on a project where there was a ‘bug bounty’ with prizes for fixing the most bugs in a month. The developer that won in the first month fixed an incredible number of bugs compared to all other developers and won an iPod. How did he fix more than everyone else? He searched far back in the backlog and picked up and fixed all the simplest/easiest/quickest to fix bugs. A lot of those issues resolved were trivial ‘nice to haves’ that didn’t add any substantial value.

Be careful what you measure because by incentivising something that’s what you’ll end up with, whether that’s really what you were aiming to achieve or not.