Open WebUI + Ollama issue on Ubunto #198594
Replies: 6 comments
-
|
The key part of the error is: “Cannot connect to host host.docker.internal:11434 [Name or service not known]” That suggests this isn’t actually an Ollama or model issue yet—it’s a networking/DNS resolution problem inside the Open WebUI container. A couple things I’d check:
docker exec -it <container_name> bash If it doesn’t resolve, Open WebUI will never be able to reach Ollama using that hostname.
ss -tulpn | grep 11434 If Ollama is only bound to 127.0.0.1:11434, containers won’t be able to reach it even if DNS is working correctly.
curl http://:11434/api/tags If that works, you’ve narrowed the issue down to hostname resolution rather than Open WebUI itself. One thing worth mentioning is that host.docker.internal works out of the box on Docker Desktop, but on Linux it can be a little more finicky depending on Docker version and how the container was started. In many Ubuntu setups I’ve had better luck using the host’s actual IP address or ensuring the host mapping is present inside the container. I’d be curious whether curl http://host.docker.internal:11434/api/tags succeeds from inside the Open WebUI container. That would tell us very quickly whether the problem is DNS resolution, network reachability, or Ollama’s bind address. |
Beta Was this translation helpful? Give feedback.
-
|
On Linux, Try these fixes:
These approaches should let Open WebUI connect properly to Ollama on Ubuntu. |
Beta Was this translation helpful? Give feedback.
-
|
Welcome to the community! Don't apologise. Docker networking on Linux is notoriously tricky and is a rite of passage for anyone getting into self-hosting. The issue you are running into is caused by two overlapping quirks with how Linux, Docker, and Ollama handle networking:
Even though you tried the Here is the step-by-step fix to get them talking. Step 1: Tell Ollama to listen to the Docker networkWe need to configure Ollama to bind to
sudo systemctl edit ollama.service
[Service]
Environment="OLLAMA_HOST=0.0.0.0"
sudo systemctl daemon-reload
sudo systemctl restart ollama
Step 2: Relaunch Open WebUINow that Ollama's door is open, we can run Open WebUI with the correct networking flag. Run your Docker command using the docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main
Step 3: Configure the WebUI Connection
It should now flash green and connect successfully! (Note: If you decided to use Hope this helps |
Beta Was this translation helpful? Give feedback.
-
|
No need to apologize at all—this is the perfect place to ask, and you ran into a very common Linux Docker quirk. Fix 1: Use your Docker Bridge IP (Recommended)Instead of relying on host.docker.internal, you can point Open WebUI directly to your Ubuntu host's gateway IP.
ip route show | grep default | awk '{print $3}' (This usually outputs 172.17.0.1 or your local network IP). Fix 2: Properly map the host gateway in DockerIf you want to keep using the host.docker.internal string, you have to explicitly tell Docker on Linux what it means using the host-gateway target. docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway --name open-webui --restart always ghcr.io/open-webui/open-webui:main Fix 3: Check Ollama's Bind Address (OLLAMA_HOST)By default, Ollama on Linux often binds strictly to 127.0.0.1 (localhost). If it does, Docker containers cannot talk to it.
sudo ss -tulpn | grep 11434
sudo systemctl edit ollama.service
[Service]
sudo systemctl daemon-reload Give Fix 1 or Fix 2 a shot first, as they usually clear up the DNS routing issue immediately. Let us know if that gets it working for you! |
Beta Was this translation helpful? Give feedback.
-
|
The other replies have the core fix covered. One extra option worth knowing about if you want to avoid managing long A minimal compose file that works on Ubuntu: services:
open-webui:
image: ghcr.io/open-webui/open-webui:main
ports:
- "3000:8080"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- open-webui:/app/backend/data
restart: always
volumes:
open-webui:The You still need the |
Beta Was this translation helpful? Give feedback.
-
|
Hi @squirrel-oss , thanks for posting in GitHub Discussions! The |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Question
Body
Hi Folks, I am new to Github. Apologies if this is the wrong discussion for my problem.
Hoping someone can help with a stubborn Open WebUI + Ollama issue on Ubuntu.
I have Ollama running locally with llama3.1:8b working fine (ollama list confirms it). I’m running Open WebUI in Docker on the same server.
I’ve set up the connection pointing to http://host.docker.internal:11434/, Authentication = None, and limited it to the single model llama3.1:8b.
Every time I click Verify Connection or try to pull the model, I get “LAMA network problem”. The logs repeatedly show:
Cannot connect to host host.docker.internal:11434 ssl:default [Name or service not known]
I’ve tried:
Both the --add-host and --network=host versions of the docker run command
Deleting the connection completely and adding it fresh
Authority set to None
Single model mode instead of “all”
The container starts fine and I can reach the WebUI, but it just won’t talk to Ollama properly.
Would anyone have any ideas what I might be missing? I’d be really grateful for any suggestions.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions