ollama - 💡(How to fix) Fix [WSL2] Ollama on Windows host unreachable from Docker container/sandbox after proxy bypass (connections timeout) [3 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#14947Fetched 2026-04-08 00:58:22
View on GitHub
Comments
3
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×3closed ×1

Ollama is installed on a Windows 11 host with OLLAMA_HOST=0.0.0.0:11434. It is healthy and reachable from the WSL2 Ubuntu 24.04 host shell. However, from inside a Docker container (NemoClaw sandbox) running inside WSL2, direct connections to the Windows-hosted Ollama instance time out after proxy bypass. This makes it impossible to use Ollama as a local inference backend from containerized workloads on the same machine.

Root Cause

Ollama is installed on a Windows 11 host with OLLAMA_HOST=0.0.0.0:11434. It is healthy and reachable from the WSL2 Ubuntu 24.04 host shell. However, from inside a Docker container (NemoClaw sandbox) running inside WSL2, direct connections to the Windows-hosted Ollama instance time out after proxy bypass. This makes it impossible to use Ollama as a local inference backend from containerized workloads on the same machine.

Fix Action

Fix / Workaround

Any guidance on the supported networking path or a known workaround (e.g., host-side relay, socat bridge, Docker --network host flag) would be very helpful.

Code Example

curl http://<WSL-host-IP>:11434/api/tags   # HTTP 200, returns model JSON
curl http://<Windows-LAN-IP>:11434/api/tags  # HTTP 200, returns model JSON

---

# Inside container:
curl --noproxy '*' http://<WSL-host-IP>:11434/api/tags    # TIMEOUT
curl --noproxy '*' http://<Windows-LAN-IP>:11434/api/tags   # TIMEOUT
curl --noproxy '*' http://host.docker.internal:11434/api/tags  # No response
RAW_BUFFERClick to expand / collapse

Summary

Ollama is installed on a Windows 11 host with OLLAMA_HOST=0.0.0.0:11434. It is healthy and reachable from the WSL2 Ubuntu 24.04 host shell. However, from inside a Docker container (NemoClaw sandbox) running inside WSL2, direct connections to the Windows-hosted Ollama instance time out after proxy bypass. This makes it impossible to use Ollama as a local inference backend from containerized workloads on the same machine.

Environment

  • Host OS: Windows 11
  • WSL2 distro: Ubuntu 24.04 LTS
  • GPU: NVIDIA RTX 4060 Ti 8 GB
  • Ollama: Installed on Windows host (not inside WSL or Docker)
  • OLLAMA_HOST: 0.0.0.0:11434
  • Docker: Engine installed inside WSL2 Ubuntu (not Docker Desktop)
  • Container: NemoClaw sandbox (Docker container running inside WSL2)

What Works

  • Ollama is healthy on Windows: curl http://127.0.0.1:11434/api/tags returns HTTP 200 on Windows
  • netstat on Windows shows Ollama listening on 0.0.0.0:11434 and [::]:11434
  • From the WSL2 host shell, both of these succeed:
curl http://<WSL-host-IP>:11434/api/tags   # HTTP 200, returns model JSON
curl http://<Windows-LAN-IP>:11434/api/tags  # HTTP 200, returns model JSON

What Fails

From inside the Docker container (running inside WSL2), after bypassing proxy settings with --noproxy '*':

# Inside container:
curl --noproxy '*' http://<WSL-host-IP>:11434/api/tags    # TIMEOUT
curl --noproxy '*' http://<Windows-LAN-IP>:11434/api/tags   # TIMEOUT
curl --noproxy '*' http://host.docker.internal:11434/api/tags  # No response

Without --noproxy '*', requests go through the container's HTTP_PROXY / HTTPS_PROXY / ALL_PROXY settings and return HTTP 403 from the proxy.

DNS resolution inside the container works (e.g. host.docker.internal resolves to 172.17.0.1), but TCP connections to port 11434 on Windows host IPs time out.

What I Already Ruled Out

  • Ollama is not down and not bound only to localhost
  • WSL2 host-to-Windows networking for Ollama is not broken
  • Docker installation is not broken
  • The container itself is not broken (cloud-backed inference works fine from the same container)
  • Windows Firewall was checked — port 11434 appears open for WSL

Questions for Ollama Maintainers

  1. Is there a known issue with Ollama on Windows being unreachable from Docker containers running inside WSL2 (not Docker Desktop)?
  2. Is host.docker.internal expected to route to the Windows host when Docker Engine is installed natively inside WSL2 (not via Docker Desktop)?
  3. Is there a recommended addressing pattern for reaching Windows-hosted Ollama from a Docker container inside WSL2?
    • WSL host gateway IP?
    • Windows LAN IP?
    • A specific hostname?
  4. Are there any known proxy variable interactions (HTTP_PROXY, HTTPS_PROXY) that intercept Ollama traffic inside containers even after --noproxy is set?
  5. Is there a recommended OLLAMA_HOST configuration or Windows Firewall rule to support this topology?

Additional Context

This issue surfaced while trying to use Ollama as a local inference provider from a NemoClaw (NVIDIA) sandbox. The same sandbox reaches the NVIDIA Cloud API without issue, which confirms the container networking itself is functional for outbound connections. The failure is specific to reaching the Windows-hosted Ollama instance from inside the Docker network namespace on WSL2.

Any guidance on the supported networking path or a known workaround (e.g., host-side relay, socat bridge, Docker --network host flag) would be very helpful.

Cross-reference: This same problem has been filed on the NemoClaw (NVIDIA) side as NVIDIA/NemoClaw#336[WSL2] NemoClaw sandbox cannot reach Windows-hosted Ollama — local inference path blocked. That issue documents the full end-to-end troubleshooting trail from the NemoClaw/sandbox perspective. The Ollama-side question is specifically: does Ollama on Windows have any known limitation or recommended configuration for being reached from Docker containers running inside WSL2 (native Docker Engine, not Docker Desktop)?

extent analysis

Fix Plan

To resolve the issue of Ollama being unreachable from Docker containers running inside WSL2, follow these steps:

  1. Use the WSL host gateway IP: Instead of using host.docker.internal or the Windows LAN IP, try using the WSL host gateway IP to reach the Ollama instance.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING