[GH-ISSUE #10833] Connection failed for Ollama with default docker command for Ollama #16047

Closed
opened 2026-04-19 22:05:19 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @FabricSoul on GitHub (Feb 26, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/10833

Bug Report

Installation Method

Docker container installation using:

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

Environment

  • Open WebUI Version: v0.5.16
  • Ollama (if applicable): 0.3.12
  • Operating System: NixOS
  • Browser (if applicable): [Need browser information]

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Open WebUI should connect to the Ollama API running on the host machine, allowing me to use Ollama models within the Open WebUI interface.

Actual Behavior:

The Docker container cannot connect to the Ollama API that's running locally on my NixOS machine. The logs show connection errors with the message: "Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)]"

Description

Bug Summary:
Open WebUI Docker container fails to connect to locally hosted Ollama API on NixOS despite using the --add-host=host.docker.internal:host-gateway flag, which should allow the container to access the host network.

Reproduction Details

Steps to Reproduce:

  1. Set up Ollama on NixOS with the following configuration:
    services.ollama = {
      enable = true;
      acceleration = "cuda";
      host = "0.0.0.0";
    };
    
  2. Configure Docker on NixOS:
    {...}: {
      virtualisation.docker.enable = true;
    }
    
  3. Start Ollama service
  4. Run Open WebUI Docker container with:
    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
    
  5. Access Open WebUI at http://localhost:3000
  6. Observe the connection error to Ollama in the logs

Logs and Screenshots

Docker Container Logs:

 ██████╗ ██████╗ ███████╗███╗   ██╗    ██╗    ██╗███████╗██████╗ ██╗   ██╗██╗
██╔═══██╗██╔══██╗██╔════╝████╗  ██║    ██║    ██║██╔════╝██╔══██╗██║   ██║██║
██║   ██║██████╔╝█████╗  ██╔██╗ ██║    ██║ █╗ ██║█████╗  ██████╔╝██║   ██║██║
██║   ██║██╔═══╝ ██╔══╝  ██║╚██╗██║    ██║███╗██║██╔══╝  ██╔══██╗██║   ██║██║
╚██████╔╝██║     ███████╗██║ ╚████║    ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║
 ╚═════╝ ╚═╝     ╚═════���╝╚═╝  ╚═══╝     ╚══╝╚══╝ ╚══════╝╚═════╝  ╚═════╝ ╚═╝
v0.5.16 - building the best open-source AI user interface.
https://github.com/open-webui/open-webui
Fetching 30 files: 100%|██████████| 30/30 [00:21<00:00,  1.43it/s]
INFO:     Started server process [1]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO:     172.17.0.1:51916 - "GET /error HTTP/1.1" 200 OK
INFO:     172.17.0.1:51916 - "GET /static/loader.js HTTP/1.1" 200 OK
INFO:     172.17.0.1:51916 - "GET /static/splash.png HTTP/1.1" 200 OK
INFO:     172.17.0.1:51916 - "GET /_app/immutable/nodes/36.63Srzcco.js HTTP/1.1" 200 OK
INFO:     172.17.0.1:51916 - "GET /api/config HTTP/1.1" 200 OK
INFO:     ('172.17.0.1', 51932) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted]
INFO:     connection open
INFO:     172.17.0.1:51916 - "GET /api/v1/auths/ HTTP/1.1" 401 Unauthorized
INFO:     172.17.0.1:51916 - "GET /_app/immutable/nodes/35.BszZUdmf.js HTTP/1.1" 304 Not Modified
INFO:     172.17.0.1:51934 - "GET /_app/immutable/assets/35.DUP86x5U.css HTTP/1.1" 304 Not Modified
INFO:     172.17.0.1:51916 - "GET /static/favicon.png HTTP/1.1" 200 OK
INFO:     172.17.0.1:51934 - "GET /assets/images/adam.jpg HTTP/1.1" 200 OK
INFO:     172.17.0.1:51940 - "GET /assets/images/galaxy.jpg HTTP/1.1" 200 OK
INFO:     172.17.0.1:51952 - "GET /assets/images/earth.jpg HTTP/1.1" 200 OK
INFO:     172.17.0.1:51968 - "GET /assets/images/space.jpg HTTP/1.1" 200 OK
INFO:     172.17.0.1:51934 - "GET /assets/fonts/InstrumentSerif-Regular.ttf HTTP/1.1" 200 OK
INFO  [open_webui.env] Saving 'ENABLE_SIGNUP' to the database
INFO  [open_webui.models.auths] insert_new_auth
INFO:     172.17.0.1:33312 - "POST /api/v1/auths/signup HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/config HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/changelog HTTP/1.1" 200 OK
INFO:     172.17.0.1:33328 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO  [open_webui.routers.openai] get_all_models()
INFO  [open_webui.routers.ollama] get_all_models()
ERROR [open_webui.routers.ollama] Connection error: Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)]
INFO:     172.17.0.1:33312 - "GET /api/models HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/v1/configs/banners HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/v1/tools/ HTTP/1.1" 200 OK
INFO:     172.17.0.1:54258 - "GET /api/v1/channels/ HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/version/updates HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /static/favicon.png HTTP/1.1" 304 Not Modified
INFO:     172.17.0.1:33312 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/v1/chats/pinned HTTP/1.1" 200 OK
INFO:     172.17.0.1:33312 - "GET /api/v1/folders/ HTTP/1.1" 200 OK
INFO:     172.17.0.1:54258 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK
ERROR [open_webui.routers.ollama] Connection error: Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)]
INFO:     172.17.0.1:54264 - "GET /ollama/api/version HTTP/1.1" 500 Internal Server Error

Browser Console Logs:
[Need browser console logs if available]

Additional Information

  1. Ollama service is configured to listen on all interfaces with host = "0.0.0.0" in the NixOS configuration.
  2. Docker is properly configured and enabled on the NixOS system.
  3. The Docker container is using the --add-host=host.docker.internal:host-gateway flag to facilitate host access.
  4. Despite these configurations, the Open WebUI container cannot connect to the Ollama API running on port 11434.

I suspect this might be related to how NixOS handles networking between Docker containers and host services, possibly requiring additional configuration beyond the standard Docker networking flags.

Note

I have checked for similar issues in the repositories before submitting this bug report and have confirmed that this is a reproducible issue specific to the NixOS environment.

Originally created by @FabricSoul on GitHub (Feb 26, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/10833 # Bug Report ## Installation Method Docker container installation using: ``` 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 ``` ## Environment - **Open WebUI Version:** v0.5.16 - **Ollama (if applicable):** 0.3.12 - **Operating System:** NixOS - **Browser (if applicable):** [Need browser information] **Confirmation:** - [x] I have read and followed all the instructions provided in the README.md. - [x] I am on the latest version of both Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Open WebUI should connect to the Ollama API running on the host machine, allowing me to use Ollama models within the Open WebUI interface. ## Actual Behavior: The Docker container cannot connect to the Ollama API that's running locally on my NixOS machine. The logs show connection errors with the message: "Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)]" ## Description **Bug Summary:** Open WebUI Docker container fails to connect to locally hosted Ollama API on NixOS despite using the `--add-host=host.docker.internal:host-gateway` flag, which should allow the container to access the host network. ## Reproduction Details **Steps to Reproduce:** 1. Set up Ollama on NixOS with the following configuration: ```nix services.ollama = { enable = true; acceleration = "cuda"; host = "0.0.0.0"; }; ``` 2. Configure Docker on NixOS: ```nix {...}: { virtualisation.docker.enable = true; } ``` 3. Start Ollama service 4. Run Open WebUI Docker container with: ``` 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 ``` 5. Access Open WebUI at http://localhost:3000 6. Observe the connection error to Ollama in the logs ## Logs and Screenshots **Docker Container Logs:** ``` ██████╗ ██████╗ ███████╗███╗ ██╗ ██╗ ██╗███████╗██████╗ ██╗ ██╗██╗ ██╔═══██╗██╔══██╗██╔════╝████╗ ██║ ██║ ██║██╔════╝██╔══██╗██║ ██║██║ ██║ ██║██████╔╝█████╗ ██╔██╗ ██║ ██║ █╗ ██║█████╗ ██████╔╝██║ ██║██║ ██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║███╗██║██╔══╝ ██╔══██╗██║ ██║██║ ╚██████╔╝██║ ███████╗██║ ╚████║ ╚███╔███╔╝███████╗██████╔╝╚██████╔╝██║ ╚═════╝ ╚═╝ ╚═════���╝╚═╝ ╚═══╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ╚═════╝ ╚═╝ v0.5.16 - building the best open-source AI user interface. https://github.com/open-webui/open-webui Fetching 30 files: 100%|██████████| 30/30 [00:21<00:00, 1.43it/s] INFO: Started server process [1] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) INFO: 172.17.0.1:51916 - "GET /error HTTP/1.1" 200 OK INFO: 172.17.0.1:51916 - "GET /static/loader.js HTTP/1.1" 200 OK INFO: 172.17.0.1:51916 - "GET /static/splash.png HTTP/1.1" 200 OK INFO: 172.17.0.1:51916 - "GET /_app/immutable/nodes/36.63Srzcco.js HTTP/1.1" 200 OK INFO: 172.17.0.1:51916 - "GET /api/config HTTP/1.1" 200 OK INFO: ('172.17.0.1', 51932) - "WebSocket /ws/socket.io/?EIO=4&transport=websocket" [accepted] INFO: connection open INFO: 172.17.0.1:51916 - "GET /api/v1/auths/ HTTP/1.1" 401 Unauthorized INFO: 172.17.0.1:51916 - "GET /_app/immutable/nodes/35.BszZUdmf.js HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:51934 - "GET /_app/immutable/assets/35.DUP86x5U.css HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:51916 - "GET /static/favicon.png HTTP/1.1" 200 OK INFO: 172.17.0.1:51934 - "GET /assets/images/adam.jpg HTTP/1.1" 200 OK INFO: 172.17.0.1:51940 - "GET /assets/images/galaxy.jpg HTTP/1.1" 200 OK INFO: 172.17.0.1:51952 - "GET /assets/images/earth.jpg HTTP/1.1" 200 OK INFO: 172.17.0.1:51968 - "GET /assets/images/space.jpg HTTP/1.1" 200 OK INFO: 172.17.0.1:51934 - "GET /assets/fonts/InstrumentSerif-Regular.ttf HTTP/1.1" 200 OK INFO [open_webui.env] Saving 'ENABLE_SIGNUP' to the database INFO [open_webui.models.auths] insert_new_auth INFO: 172.17.0.1:33312 - "POST /api/v1/auths/signup HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/config HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/changelog HTTP/1.1" 200 OK INFO: 172.17.0.1:33328 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK INFO [open_webui.routers.openai] get_all_models() INFO [open_webui.routers.ollama] get_all_models() ERROR [open_webui.routers.ollama] Connection error: Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)] INFO: 172.17.0.1:33312 - "GET /api/models HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/v1/configs/banners HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/v1/tools/ HTTP/1.1" 200 OK INFO: 172.17.0.1:54258 - "GET /api/v1/channels/ HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/version/updates HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /static/favicon.png HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:33312 - "GET /api/v1/users/user/settings HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/v1/chats/all/tags HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/v1/chats/pinned HTTP/1.1" 200 OK INFO: 172.17.0.1:33312 - "GET /api/v1/folders/ HTTP/1.1" 200 OK INFO: 172.17.0.1:54258 - "GET /api/v1/chats/?page=1 HTTP/1.1" 200 OK ERROR [open_webui.routers.ollama] Connection error: Cannot connect to host host.docker.internal:11434 ssl:default [Connect call failed ('172.17.0.1', 11434)] INFO: 172.17.0.1:54264 - "GET /ollama/api/version HTTP/1.1" 500 Internal Server Error ``` **Browser Console Logs:** [Need browser console logs if available] ## Additional Information 1. Ollama service is configured to listen on all interfaces with `host = "0.0.0.0"` in the NixOS configuration. 2. Docker is properly configured and enabled on the NixOS system. 3. The Docker container is using the `--add-host=host.docker.internal:host-gateway` flag to facilitate host access. 4. Despite these configurations, the Open WebUI container cannot connect to the Ollama API running on port 11434. I suspect this might be related to how NixOS handles networking between Docker containers and host services, possibly requiring additional configuration beyond the standard Docker networking flags. ## Note I have checked for similar issues in the repositories before submitting this bug report and have confirmed that this is a reproducible issue specific to the NixOS environment.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#16047