Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix WebSocket localhost bug by passing DOCKER_HOST_ADDR to runtime containers (#12113)

shanemort19825407ea55aa94
diff --git a/openhands/runtime/impl/docker/docker_runtime.py b/openhands/runtime/impl/docker/docker_runtime.py
index b5eb4c5735..effac9d7a2 100644
--- a/openhands/runtime/impl/docker/docker_runtime.py
+++ b/openhands/runtime/impl/docker/docker_runtime.py
@@ -472,6 +472,9 @@ class DockerRuntime(ActionExecutionClient):
)
if self.config.debug or DEBUG:
environment['DEBUG'] = 'true'
+ # Pass DOCKER_HOST_ADDR to spawned containers if it exists
+ if os.environ.get('DOCKER_HOST_ADDR'):
+ environment['DOCKER_HOST_ADDR'] = os.environ['DOCKER_HOST_ADDR']
# also update with runtime_startup_env_vars
environment.update(self.config.sandbox.runtime_startup_env_vars)