跳到主要内容

openhands.runtime.impl.docker.docker_runtime

DockerRuntime Objects

class DockerRuntime(ActionExecutionClient)

This runtime will subscribe the event stream.

When receive an event, it will send the event to runtime-client which run inside the docker environment.

Arguments:

  • config AppConfig - The application configuration.
  • event_stream EventStream - The event stream to subscribe to.
  • sid str, optional - The session ID. Defaults to 'default'.
  • plugins list[PluginRequirement] | None, optional - List of plugin requirements. Defaults to None.
  • env_vars dict[str, str] | None, optional - Environment variables to set. Defaults to None.

close

def close(rm_all_containers: bool | None = None)

Closes the DockerRuntime and associated objects

Arguments:

  • rm_all_containers (bool): Whether to remove all containers with the 'openhands-sandbox-' prefix

pause

def pause()

Pause the runtime by stopping the container. This is different from container.stop() as it ensures environment variables are properly preserved.

resume

def resume()

Resume the runtime by starting the container. This is different from container.start() as it ensures environment variables are properly restored.