bytebot icon indicating copy to clipboard operation
bytebot copied to clipboard

Linux Docker container cannot connect to host service despite correct network configuration

Open Quarkisinproton opened this issue 4 months ago • 2 comments

## Bug Report

System Information:

  • OS: Ubuntu (Linux)
  • **Docker Version:**Docker version 28.4.0

Problem Description: A Docker container cannot establish a network connection to a service running on the host machine, even when all configurations appear correct. This prevents Bytebot from connecting to a local Ollama instance.

Evidence:

  1. Ollama service is working correctly on the host: The command curl http://localhost:11434/api/tags run directly on the host machine succeeds and returns the correct list of models.

  2. Ollama is listening on all network interfaces: The command sudo ss -tulpn | grep ollama shows that the service is listening on *:11434 (or 0.0.0.0:11434), which is correct.

  3. Connection from a Docker container fails: A definitive test using a network-troubleshooting container (nicolaka/netshoot) fails. The command curl http://172.17.0.1:11434/api/tags (where 172.17.0.1 is the host's IP on the docker0 bridge) results in a connection timeout error: curl: (28) Failed to connect to 172.17.0.1 port 11434... Could not connect to server.

Troubleshooting Steps Performed: This issue persists even after:

  • Configuring Docker's DNS in /etc/docker/daemon.json.
  • Temporarily disabling the ufw firewall.
  • Verifying all application-level configurations (.env, docker-compose.yml).
  • Attempting to use both Docker's bridge network and network_mode: host.

Conclusion: There appears to be a fundamental network block between the Docker networking stack and the host system that is preventing container-to-host communication.

Quarkisinproton avatar Sep 07 '25 15:09 Quarkisinproton

Is this specific to Ollama or other network configs? I can verify that the Docker containers can connect to other host services, it's how we develop the bytebot-agent locally.

atupem avatar Sep 11 '25 16:09 atupem

Is this specific to Ollama or other network configs? I can verify that the Docker containers can connect to other host services, it's how we develop the bytebot-agent locally.

Hey@atupem ,Sorry for the delay I ran the test you asked for.

I spun up a simple Python server on my machine, and then tried to hit it from inside a netshoot container.

It failed with the same timeout error. So yeah, it looks like no container can connect to any service on my computer, not just Ollama.

Image

Hope this helps track down the problem!

Quarkisinproton avatar Sep 24 '25 05:09 Quarkisinproton