Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Interpretml Interpret Powerlift InsecureDocker

From Leeroopedia


Knowledge Sources
Domains Benchmarking, Docker, Execution
Last Updated 2026-02-07 12:00 GMT

Overview

Local Docker executor that runs Powerlift benchmark trials in Docker containers on the local machine, using host networking and environment variables for configuration.

Description

The InsecureDocker class extends LocalMachine to run trial workloads inside local Docker containers. It is designed for testing container-based workflows locally before deploying to remote services like Azure Container Instances.

Key characteristics:

  • Security warning -- Named "insecure" because it passes the database connection string via environment variables and uses network_mode="host", which means other users on the machine may see the connection string by enumerating processes.
  • Docker SDK integration -- Uses the docker Python package to create and manage containers via docker.from_env().
  • Container lifecycle -- Each runner spawns a detached container that executes python -m powerlift.run, waits for completion, and then removes the container.
  • Multiprocessing dispatch -- Inherits the multiprocessing pool from LocalMachine and dispatches the _run_docker helper function to run containers in parallel.
  • Environment variables -- Passes EXPERIMENT_ID, RUNNER_ID, DB_URL, and TIMEOUT as environment variables to each container.

Usage

Use this executor for local testing of Dockerized benchmark workflows. It validates that Docker images work correctly with Powerlift before deploying to remote container services. Only run on fully trusted machines due to the insecure passing of database credentials via environment variables.

Code Reference

Source Location

Signature

def _run_docker(experiment_id, runner_id, db_url, timeout, image):
    ...

class InsecureDocker(LocalMachine):
    def __init__(
        self,
        store: Store,
        image: str = "mcr.microsoft.com/devcontainers/python:3.12",
        n_running_containers: Optional[int] = None,
        wheel_filepaths: Optional[List[str]] = None,
        docker_db_uri: Optional[str] = None,
    ): ...

    def submit(self, experiment_id, timeout=None): ...

    @property
    def docker_db_uri(self): ...

    @property
    def image(self): ...

Import

from powerlift.executors.docker import InsecureDocker

I/O Contract

Inputs

Name Type Required Description
store Store Yes Store instance that houses trials and provides the database URI
image str No Docker image to execute (default: "mcr.microsoft.com/devcontainers/python:3.12")
n_running_containers int No Maximum number of containers running simultaneously (defaults to CPU count)
wheel_filepaths List[str] No Wheel files to install in the container
docker_db_uri str No Database URI override for container use

Outputs

Name Type Description
_run_docker return dict Docker container exit code dictionary
join() return List List of container exit code results (inherited from LocalMachine)

Usage Examples

from powerlift.bench.store import Store
from powerlift.executors.docker import InsecureDocker

store = Store("postgresql://user:pass@host/db")

executor = InsecureDocker(
    store=store,
    image="mcr.microsoft.com/devcontainers/python:3.12",
    n_running_containers=4,
)

executor.submit(experiment_id=1, timeout=3600)
results = executor.join()

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment