mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
feat: Adding sandbox property runtime_binding_address to specify whic… (#6992)
This commit is contained in:
parent
7810d8c4a0
commit
2b3c38d061
@ -385,6 +385,11 @@ To use these with the docker command, pass in `-e SANDBOX_<option>`. Example: `-
|
|||||||
- Default: `false`
|
- Default: `false`
|
||||||
- Description: Use host network
|
- Description: Use host network
|
||||||
|
|
||||||
|
- `runtime_binding_address`
|
||||||
|
- Type: `str`
|
||||||
|
- Default: `127.0.0.1`
|
||||||
|
- Description: The binding address for the runtime ports. It specifies which network interface on the host machine Docker should bind the runtime ports to.
|
||||||
|
|
||||||
### Linting and Plugins
|
### Linting and Plugins
|
||||||
- `enable_auto_lint`
|
- `enable_auto_lint`
|
||||||
- Type: `bool`
|
- Type: `bool`
|
||||||
|
|||||||
@ -17,6 +17,7 @@ class SandboxConfig(BaseModel):
|
|||||||
remote_runtime_api_timeout: The timeout for the remote runtime API requests.
|
remote_runtime_api_timeout: The timeout for the remote runtime API requests.
|
||||||
enable_auto_lint: Whether to enable auto-lint.
|
enable_auto_lint: Whether to enable auto-lint.
|
||||||
use_host_network: Whether to use the host network.
|
use_host_network: Whether to use the host network.
|
||||||
|
runtime_binding_address: The binding address for the runtime ports. It specifies which network interface on the host machine Docker should bind the runtime ports to.
|
||||||
initialize_plugins: Whether to initialize plugins.
|
initialize_plugins: Whether to initialize plugins.
|
||||||
force_rebuild_runtime: Whether to force rebuild the runtime image.
|
force_rebuild_runtime: Whether to force rebuild the runtime image.
|
||||||
runtime_extra_deps: The extra dependencies to install in the runtime image (typically used for evaluation).
|
runtime_extra_deps: The extra dependencies to install in the runtime image (typically used for evaluation).
|
||||||
@ -60,6 +61,7 @@ class SandboxConfig(BaseModel):
|
|||||||
default=False
|
default=False
|
||||||
) # once enabled, OpenHands would lint files after editing
|
) # once enabled, OpenHands would lint files after editing
|
||||||
use_host_network: bool = Field(default=False)
|
use_host_network: bool = Field(default=False)
|
||||||
|
runtime_binding_address: str = Field(default='127.0.0.1')
|
||||||
runtime_extra_build_args: list[str] | None = Field(default=None)
|
runtime_extra_build_args: list[str] | None = Field(default=None)
|
||||||
initialize_plugins: bool = Field(default=True)
|
initialize_plugins: bool = Field(default=True)
|
||||||
force_rebuild_runtime: bool = Field(default=False)
|
force_rebuild_runtime: bool = Field(default=False)
|
||||||
|
|||||||
@ -201,16 +201,29 @@ class DockerRuntime(ActionExecutionClient):
|
|||||||
port_mapping: dict[str, list[dict[str, str]]] | None = None
|
port_mapping: dict[str, list[dict[str, str]]] | None = None
|
||||||
if not use_host_network:
|
if not use_host_network:
|
||||||
port_mapping = {
|
port_mapping = {
|
||||||
f'{self._container_port}/tcp': [{'HostPort': str(self._host_port)}],
|
f'{self._container_port}/tcp': [
|
||||||
|
{
|
||||||
|
'HostPort': str(self._host_port),
|
||||||
|
'HostIp': self.config.sandbox.runtime_binding_address,
|
||||||
|
}
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.vscode_enabled:
|
if self.vscode_enabled:
|
||||||
port_mapping[f'{self._vscode_port}/tcp'] = [
|
port_mapping[f'{self._vscode_port}/tcp'] = [
|
||||||
{'HostPort': str(self._vscode_port)}
|
{
|
||||||
|
'HostPort': str(self._vscode_port),
|
||||||
|
'HostIp': self.config.sandbox.runtime_binding_address,
|
||||||
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
for port in self._app_ports:
|
for port in self._app_ports:
|
||||||
port_mapping[f'{port}/tcp'] = [{'HostPort': str(port)}]
|
port_mapping[f'{port}/tcp'] = [
|
||||||
|
{
|
||||||
|
'HostPort': str(port),
|
||||||
|
'HostIp': self.config.sandbox.runtime_binding_address,
|
||||||
|
}
|
||||||
|
]
|
||||||
else:
|
else:
|
||||||
self.log(
|
self.log(
|
||||||
'warn',
|
'warn',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user