Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Allow workspace_mount_path to use relative paths (#9615)

mindflow-cn7acee9e5da32
diff --git a/openhands/runtime/impl/docker/docker_runtime.py b/openhands/runtime/impl/docker/docker_runtime.py
index 57893e06af..1785576dca 100644
--- a/openhands/runtime/impl/docker/docker_runtime.py
+++ b/openhands/runtime/impl/docker/docker_runtime.py
@@ -261,7 +261,8 @@ class DockerRuntime(ActionExecutionClient):
mount_mode = 'rw' # Default mode
# e.g. result would be: {"/home/user/openhands/workspace": {'bind': "/workspace", 'mode': 'rw'}}
- volumes[self.config.workspace_mount_path] = {
+ # Add os.path.abspath() here so that relative paths can be used when workspace_mount_path is configured in config.toml
+ volumes[os.path.abspath(self.config.workspace_mount_path)] = {
'bind': self.config.workspace_mount_path_in_sandbox,
'mode': mount_mode,
}