Skip to content

πŸ™Œ OpenHands: AI-Driven Development

feat: support dev container networking without host mode (#9122)

llamantino47b0dc548e59
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index cc3848b5b3..c90ff435ca 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -12,5 +12,8 @@
"ghcr.io/devcontainers/features/node:1": {},
},
"postCreateCommand": ".devcontainer/setup.sh",
- "runArgs": ["--network=host"],
+ "runArgs": ["--add-host=host.docker.internal:host-gateway"],
+ "containerEnv": {
+ "DOCKER_HOST_ADDR": "host.docker.internal"
+ },
}
diff --git a/containers/dev/compose.yml b/containers/dev/compose.yml
index cdcaf12f95..a62546dc26 100644
--- a/containers/dev/compose.yml
+++ b/containers/dev/compose.yml
@@ -10,13 +10,13 @@ services:
environment:
- BACKEND_HOST=${BACKEND_HOST:-"0.0.0.0"}
- SANDBOX_API_HOSTNAME=host.docker.internal
+ - DOCKER_HOST_ADDR=host.docker.internal
#
- SANDBOX_RUNTIME_CONTAINER_IMAGE=${SANDBOX_RUNTIME_CONTAINER_IMAGE:-ghcr.io/all-hands-ai/runtime:0.43-nikolaik}
- SANDBOX_USER_ID=${SANDBOX_USER_ID:-1234}
- WORKSPACE_MOUNT_PATH=${WORKSPACE_BASE:-$PWD/workspace}
ports:
- "3000:3000"
- network_mode: host
extra_hosts:
- "host.docker.internal:host-gateway"
volumes: