Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fixes for docker nested runtime (#9634)

Tim O'Farrell9331f5e8a748
diff --git a/openhands/server/conversation_manager/docker_nested_conversation_manager.py b/openhands/server/conversation_manager/docker_nested_conversation_manager.py
index aeb9d22c70..25dfba44f5 100644
--- a/openhands/server/conversation_manager/docker_nested_conversation_manager.py
+++ b/openhands/server/conversation_manager/docker_nested_conversation_manager.py
@@ -497,12 +497,10 @@ class DockerNestedConversationManager(ConversationManager):
env_vars['SESSION_API_KEY'] = self._get_session_api_key_for_conversation(sid)
# We need to be able to specify the nested conversation id within the nested runtime
env_vars['ALLOW_SET_CONVERSATION_ID'] = '1'
- env_vars['WORKSPACE_BASE'] = '/workspace'
env_vars['SANDBOX_CLOSE_DELAY'] = '0'
env_vars['SKIP_DEPENDENCY_CHECK'] = '1'
+ env_vars['INITIAL_NUM_WARM_SERVERS'] = '1'
- # Set up mounted volume for conversation directory within workspace
- # TODO: Check if we are using the standard event store and file store
volumes: list[str | None]
if not config.sandbox.volumes:
volumes = []
@@ -510,9 +508,17 @@ class DockerNestedConversationManager(ConversationManager):
volumes = [v.strip() for v in config.sandbox.volumes.split(',')]
conversation_dir = get_conversation_dir(sid, user_id)
- volumes.append(
- f'{config.file_store_path}/{conversation_dir}:/root/.openhands/file_store/{conversation_dir}:rw'
- )
+ # Set up mounted volume for conversation directory within workspace
+ if config.file_store == 'local':
+ # Resolve ~ from path as the docker container does not work otherwise
+ file_store_path = os.path.realpath(
+ os.path.expanduser(config.file_store_path)
+ )
+
+ volumes.append(
+ f'{file_store_path}/{conversation_dir}:/root/.openhands/{conversation_dir}:rw'
+ )
+
config.sandbox.volumes = ','.join([v for v in volumes if v is not None])
if not config.sandbox.runtime_container_image:
config.sandbox.runtime_container_image = self._runtime_container_image