-
Notifications
You must be signed in to change notification settings - Fork 77
Description
name: 🐞 Bug Report
about: Report a reproducible bug or unexpected behavior
title: 'Windows Docker Networking Issues - network_mode:host and Hard-coded localhost URLs'
labels: bug, docker, windows, networking, cross-platform
Description of the issue:
The CortexON project fails to run on Windows due to two related Docker networking issues that prevent inter-service communication:
-
network_mode: hostincompatibility: Thedocker-compose.yamlusesnetwork_mode: host, which is not supported on Windows Docker Desktop. This prevents services from being accessible onlocalhostfrom the Windows host machine. -
Hard-coded localhost URLs: After fixing the network mode, inter-container communication fails because
cortex_on/agents/web_surfer.pyandcortex_on/agents/orchestrator_agent.pyuse hard-codedhttp://localhost:8000URLs to communicate with theagentic_browserservice. In Docker bridge networking, containers must use service names (e.g.,http://agentic_browser:8000) instead oflocalhost.
These issues prevent the web surfer agent from functioning, causing all web surfing tasks to fail with connection errors.
Steps to reproduce:
- Clone the repository on a Windows machine with Docker Desktop installed
- Run
docker-compose up --buildto start all services - Attempt to access the frontend at
http://localhost:3000(fails withnetwork_mode: host) - Fix
docker-compose.yamlby replacingnetwork_mode: hostwith explicit port mappings - Restart services with
docker-compose down && docker-compose up -d - Access frontend at
http://localhost:3000(now works) - Submit a task requiring the web surfer agent: "Check today's gold prices in Mumbai from Goodreturns.in"
- Observe error logs showing connection failure to
localhost:8000
Expected behavior:
- All services should be accessible on
localhostwith their respective ports (frontend: 3000, agentic_browser: 8000, cortex_on: 8081) - The
cortex_onservice should successfully communicate with theagentic_browserservice using Docker service names - Web surfer tasks should execute without connection errors
- The system should work identically on Windows, Linux, and macOS
Actual behavior:
Stage 1 - With network_mode: host:
- Services start but are NOT accessible on
localhostfrom Windows host - Frontend only accessible via Docker internal IPs (e.g.,
http://192.168.65.6:3000/) http://localhost:3000returnsERR_CONNECTION_REFUSED
Stage 2 - After fixing network mode to use port mappings:
- Services become accessible on
localhost✅ - Inter-container communication fails with:
Error making API call: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)] Failed to generate web surfer reply: Cannot connect to host localhost:8000 - All web surfer agent tasks fail immediately
- Gold price analysis task cannot retrieve data from Goodreturns.in
Screenshots/Logs [Mandatory]:
Error Logs from cortex_on Service:
cortex_on | 15:01:25.403 Assigning web surfing task: Navigate to Goodreturns.in and collect today's gold prices...
cortex_on | Error making API call: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
cortex_on | Failed to generate web surfer reply: Cannot connect to host localhost:8000 ssl:default [Connect call failed ('127.0.0.1', 8000)]
cortex_on | 15:01:25.420 preparing model and tools run_step=3
Affected Code Files:
-
docker-compose.yaml(Lines 6, 15, 24):services: cortex_on: network_mode: host # ❌ Not supported on Windows agentic_browser: network_mode: host # ❌ Not supported on Windows frontend: network_mode: host # ❌ Not supported on Windows
-
cortex_on/agents/web_surfer.py(Line 32):class WebSurfer: def __init__(self, api_url: str = "http://localhost:8000/api/v1/web/stream"): # ❌ self.api_url = api_url
-
cortex_on/agents/orchestrator_agent.py(Line 311):@orchestrator_agent.tool async def web_surfer_task(ctx: RunContext[orchestrator_deps], task: str) -> str: # ... web_surfer_agent = WebSurfer(api_url="http://localhost:8000/api/v1/web/stream") # ❌
Environment (OS, Browser):
- Operating System: Windows 11
- Docker Desktop: Version 28.5.2
- Docker Compose: v2.40.3-desktop.1
- Python: 3.10 (in containers)
- Browser: Chrome/Edge (for frontend access)
- Affected Services:
cortex_on,agentic_browser
Root Cause
Issue 1: Windows Docker Desktop does not fully support network_mode: host. This mode only works properly on Linux. On Windows, it does not expose container ports to the host machine.
Reference: Docker Documentation - Host Network Driver
Issue 2: When containers run on a Docker bridge network (the fix for Issue 1), localhost inside a container refers to that container itself, not to other containers. Docker service names must be used for inter-container communication.
Proposed Solution
Fix 1: Update docker-compose.yaml
Replace network_mode: host with explicit port mappings:
services:
cortex_on:
ports:
- "8081:8081"
# Remove network_mode: host
agentic_browser:
ports:
- "8000:8000"
# Remove network_mode: host
frontend:
ports:
- "3000:3000"
# Remove network_mode: hostFix 2: Update cortex_on/agents/web_surfer.py (Line 32)
class WebSurfer:
def __init__(self, api_url: str = "http://agentic_browser:8000/api/v1/web/stream"): # ✅
self.api_url = api_urlFix 3: Update cortex_on/agents/orchestrator_agent.py (Line 311)
@orchestrator_agent.tool
async def web_surfer_task(ctx: RunContext[orchestrator_deps], task: str) -> str:
# ...
web_surfer_agent = WebSurfer(api_url="http://agentic_browser:8000/api/v1/web/stream") # ✅
# OR simply: web_surfer_agent = WebSurfer() # Uses corrected defaultVerification
After applying all three fixes:
- Stop containers:
docker-compose down - Start services:
docker-compose up -d - Verify accessibility:
- Frontend:
http://localhost:3000✅ - CortexON API:
http://localhost:8081/docs✅ - TA-Browser API:
http://localhost:8000/docs✅
- Frontend:
- Submit a web surfer task and confirm successful execution
- No "Cannot connect to host localhost:8000" errors in logs
Priority
HIGH - Completely blocks Windows users from running the project