SealSkin
Server Reference

docker_utils

Docker host helpers: client access, self-inspection, GPUs and images.

Everything that talks to the Docker daemon outside of a launch goes through this module so the rest of the server never creates its own client.

attributelogger
= logging.getLogger(__name__)
funcget_docker_client() -> docker.DockerClient

Return the shared Docker client, creating it on first use.

Returns

docker.DockerClient

A DockerClient connected from the environment.

funccontainer_exists(instance_id) -> bool

Tell whether a container still exists on the host.

paraminstance_idstr

Container id.

Returns

bool

True if Docker knows the container, False if it is gone.

funcprune_dangling_images() -> None

Remove dangling images left behind by pulls.

Returns

None
funcinspect_self_container() -> None

Discover mount mappings, ports and network of the server's own container.

Populates state.path_prefix_map, state.discovered_api_port, state.discovered_session_port and state.discovered_network. When the server is not running inside Docker nothing is changed.

Returns

None
functranslate_path_to_host(internal_path) -> str

Map a path inside the server container to the equivalent host path.

paraminternal_pathstr

Absolute path as seen by the server process.

Returns

str

The host path when a mount prefix matches, otherwise the input.

funcread_cpu_model() -> None

Read the CPU model name from /proc/cpuinfo into state.cpu_model.

Returns

None
funcget_system_stats() -> dict[str, Any]

Return CPU model and storage usage, cached for one minute.

Returns

dict

Dictionary with cpu_model, disk_total and disk_used.

funcdetect_gpus() -> None

Detect render nodes under /sys/class/drm into state.available_gpus.

Returns

None
funcget_and_cache_image_metadata(image_name, force_refresh=False) -> None

Record the local digest of an image in state.image_metadata.

paramimage_namestr

Image reference such as ghcr.io/org/app:latest.

paramforce_refreshbool
= False

Re-query Docker even when a digest is cached.

Returns

None
funcpull_and_cache_image(image_name) -> None

Pull an image in the background and refresh its cached digest.

paramimage_namestr

Image reference to pull.

Returns

None