i posted in questions maybe not right place. Hey ...
# proj-sdk
w
i posted in questions maybe not right place. Hey team! šŸ‘‹ Running into a networking issue deploying OpenHands 1.1 as a LAN-accessible server (Docker runtime on Ubuntu 22.04). Problem: Agent-server containers can't resolve
host.docker.internal
, causing MCP connection failures and conversations stuck at
WAITING_FOR_SANDBOX
. Error:
Copy code
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/12175
s
Hi Shane! It looks like that is missing functionality we need to support
@nutritious-balloon-65098 - Please take Shane's suggestion and create a PR.
n
I'm on it! can track my progress here.
s
There are two issues currently in v1 that it sounds like your running into. The first is the agent container isolation issue. Modifying extra_hosts is the easiest solution for me currently since enabling host networking of agent container is also not working. The second issue is only web browsers running on local host are working. There are a few github issues describing it; including this one that shows how nginx can be setup in front of openhands to address it: https://github.com/OpenHands/OpenHands/issues/12072 I haven't tried any of those solutions yet and I'm only using local browsers. As far as running a newer agent image, there are currently 2 variables you can use:
Copy code
AGENT_SERVER_IMAGE_REPOSITORY="<http://ghcr.io/openhands/agent-server|ghcr.io/openhands/agent-server>"
AGENT_SERVER)_IMAGE_TAG="XXXXX-python"
šŸ‘€ 1
s
There are some issues with environment variable parsing which should be fixed by the PR was working on earlier this morning. Once both those are merged / released it should be possible to configure the extra hosts using environment variables.
n
Summary I've implemented Shane's suggestion to add
extra_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 conversation
s
I'll review the PR in the morning
w
great work nicely done, cant wait to test it out guys, loving openhands from Dublin here
s
A fellow Dubliner!
w
yep, i gather from the accent i watched a video with u in it the other day
about to come out of stealth on this bad boy and just got openhands running using our hosted models too https://tensorix.ai/
built by AI for AI šŸ™‚ openhands did all the work tbh