worried-eye-85128
01/01/2026, 11:14 AMhost.docker.internal, causing MCP connection failures and conversations stuck at WAITING_FOR_SANDBOX.
Error:
Sandbox server not running: <http://host.docker.internal:50555> : [Errno -2] Name or service not known
Root Cause: When DockerSandboxService creates agent-server containers (line ~363 in docker_sandbox_service.py), it doesn't pass the extra_hosts parameter, so agent-servers can't resolve host.docker.internal to reach the main app's MCP endpoint.
What I've tried:
ā
Added extra_hosts to main openhands-app container (works for main app)
⢠ā SANDBOX_RUNTIME_EXTRA_HOSTS (only applies to runtime containers, not agent-servers)
⢠ā Custom networks, host networking (breaks health checks)
⢠ā Docker daemon config (conflicts with existing setup)
Questions:
Is there an environment variable to pass extra_hosts to agent-server containers?
1. Should SANDBOX_AGENT_SERVER_IMAGE allow overriding the default agent-server image? (Tried this but OpenHands still uses default image)
2. Any recommended workaround for remote LAN deployment?
Temporary Fix Idea: Could we add support for AGENT_SERVER_EXTRA_HOSTS env var that gets passed through to agent-server containers?
Happy to provide more logs/details or open a GitHub issue if needed. Thanks! š
Issue logged https://github.com/OpenHands/OpenHands/issues/12175straight-sundown-84319
01/01/2026, 7:26 PMstraight-sundown-84319
01/01/2026, 7:28 PMnutritious-balloon-65098
01/01/2026, 7:29 PMsalmon-lock-64866
01/01/2026, 7:31 PMAGENT_SERVER_IMAGE_REPOSITORY="<http://ghcr.io/openhands/agent-server|ghcr.io/openhands/agent-server>"
AGENT_SERVER)_IMAGE_TAG="XXXXX-python"straight-sundown-84319
01/01/2026, 7:32 PMnutritious-balloon-65098
01/01/2026, 7:36 PMextra_hosts support to agent-server containers. The changes have been pushed and a draft PR has been created.
Changes Made
Files Modified:
1. openhands/app_server/sandbox/docker_sandbox_service.py - Added extra_hosts support
2. tests/unit/app_server/test_docker_sandbox_service.py - Added unit tests
Implementation Details:
⢠Added extra_hosts: dict[str, str] field to DockerSandboxService dataclass
⢠Added extra_hosts field to DockerSandboxServiceInjector with default {'host.docker.internal': 'host-gateway'}
⢠Pass extra_hosts to docker_client.containers.run() in start_sandbox() method
⢠Added 2 unit tests to verify the functionality
Checklist
⢠ā
Addresses Shane's suggestion to add extra_hosts support for agent-server containers
⢠ā
Default configuration includes host.docker.internal: host-gateway to fix LAN deployment issues
⢠ā
All 39 tests pass
⢠ā
Pre-commit hooks pass (linting, formatting, type checking)
⢠ā
Changes are concise and focused on the specific issue
Pull Request
Draft PR created: https://github.com/OpenHands/OpenHands/pull/12236
This fix will allow agent-server containers to resolve host.docker.internal by default, which should resolve the MCP connection failures and WAITING_FOR_SANDBOX issues in LAN deployments that Shane reported.
View full conversationstraight-sundown-84319
01/01/2026, 8:03 PMworried-eye-85128
01/01/2026, 11:09 PMstraight-sundown-84319
01/01/2026, 11:10 PMworried-eye-85128
01/01/2026, 11:10 PMworried-eye-85128
01/01/2026, 11:11 PMworried-eye-85128
01/01/2026, 11:11 PM