hyperdock_container.runtime#

Submodules#

Classes#

ContainerRuntime

Helper class that provides a standard way to create an ABC using

Package Contents#

class hyperdock_container.runtime.ContainerRuntime#

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract create(image_tag: str, workdir: str, command: str, envs: dict, **kwargs) str#

Create an image from tag :param image_tag: :param workdir: :param command: :param envs: :return: container id

abstract start(container_id: str) None#

Start a container :param container_id: :return:

abstract stop(container_id: str) None#

Stop a container :param container_id: :return:

abstract remove(container_id: str) None#

Remove a container :param container_id: :return:

abstract pull(image_tag: str) str#

Pull an image from tag and returns its id :param image: :return:

abstract list_image() list[tuple[str, list[str]]]#

List all images :return: list of image id and tag list

abstract run(container_id: str, stdin_str: str | None = None) str#

Run a command in a container :param container_id: :param stdin_str: :return: stdout_str of container

abstract put_archive(container_id: str, source: pathlib.Path, dest: str) None#

Put an archive to a container :param container_id: :param source: :param dest: :return:

abstract commit(container_id: str, repository: str, tag: str) str#

Commit a container to an image :param container_id: :param repository: :param tag: :return: image id

from_tool_request(tool_request: hyperdock_container.tool.ContainerToolRequest) list[hyperpocket.tool.function.FunctionTool]#

Create a FunctionTool from a tool request :param tool_request: :return:

from_single_tool_config(tool_image_tag: str, pocket_schema_path: pathlib.Path, overridden_tool_vars: dict[str, str] = None, runtime_arguments: dict = None) hyperpocket.tool.function.FunctionTool#
classmethod get_runtime_from_settings() ContainerRuntime#