Skip to content

Commit e6d38e2

Browse files
SkipperNZklieret
andauthored
Enh: make docker_internal_host configurable with default value (#266)
Closes #253 * fix: make docker_internal_host configurable with default value #253 issue * Apply suggestion from @klieret --------- Co-authored-by: Kilian Lieret <[email protected]>
1 parent 6d34264 commit e6d38e2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/swerex/deployment/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ class DockerDeploymentConfig(BaseModel):
4545
"""The container runtime to use (docker or podman)."""
4646
exec_shell: list[str] = ["/bin/sh", "-c"]
4747
"""The shell executable and arguments to use for running commands."""
48+
docker_internal_host: str = "http://127.0.0.1"
49+
"""The host to use for connecting to the runtime.
50+
In most cases you can leave this as-is, however for docker-in-docker
51+
setups you might have to set it to http://host.docker.internal/
52+
(see https://github.com/SWE-agent/SWE-ReX/issues/253 for more information).
53+
"""
4854

4955
type: Literal["docker"] = "docker"
5056
"""Discriminator for (de)serialization/CLI. Do not change."""

src/swerex/deployment/docker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,12 @@ async def start(self):
271271
self._hooks.on_custom_step("Starting runtime")
272272
self.logger.info(f"Starting runtime at {self._config.port}")
273273
self._runtime = RemoteRuntime.from_config(
274-
RemoteRuntimeConfig(port=self._config.port, timeout=self._runtime_timeout, auth_token=token)
274+
RemoteRuntimeConfig(
275+
host=self._config.docker_internal_host,
276+
port=self._config.port,
277+
timeout=self._runtime_timeout,
278+
auth_token=token,
279+
)
275280
)
276281
t0 = time.time()
277282
await self._wait_until_alive(timeout=self._config.startup_timeout)

0 commit comments

Comments
 (0)