CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-python-on-whales

A Docker client for Python, designed to be fun and intuitive!

Pending
Overview
Eval results
Files

images.mddocs/

Image Management

Image building, pulling, pushing, and management operations including legacy build and modern buildx support. Images serve as templates for creating containers and can be distributed through registries.

Capabilities

Image Retrieval and Distribution

Pull images from registries and push local images to remote repositories.

def pull(
    image_name: str,
    *,
    platform: Optional[str] = None,
    all_tags: bool = False,
    quiet: bool = False
) -> Image:
    """
    Pull image from registry.
    
    Parameters:
    - image_name: Image repository name and tag
    - platform: Target platform (linux/amd64, linux/arm64, etc.)
    - all_tags: Pull all tagged images in repository
    - quiet: Suppress verbose output
    
    Returns:
    - Image object
    """

def push(
    image_name: str,
    *,
    all_tags: bool = False,
    quiet: bool = False
) -> str:
    """
    Push image to registry.
    
    Parameters:
    - image_name: Image repository name and tag
    - all_tags: Push all tagged images in repository
    - quiet: Suppress verbose output
    
    Returns:
    - Push operation output
    """

Image Building

Build images from Dockerfiles using legacy build or modern buildx.

def build(
    context_path: str,
    *,
    tags: Optional[List[str]] = None,
    dockerfile: Optional[str] = None,
    build_args: Optional[Dict[str, str]] = None,
    target: Optional[str] = None,
    no_cache: bool = False,
    pull: bool = False,
    rm: bool = True,
    force_rm: bool = False,
    labels: Optional[Dict[str, str]] = None,
    cache_from: Optional[List[str]] = None,
    platforms: Optional[List[str]] = None,
    push: bool = False,
    load: bool = True,
    progress: str = "auto"
) -> Image:
    """
    Build image from Dockerfile using buildx.
    
    Parameters:
    - context_path: Build context directory
    - tags: Image tags to apply
    - dockerfile: Dockerfile path (relative to context)
    - build_args: Build-time variables
    - target: Target build stage
    - no_cache: Don't use cache when building
    - pull: Always pull newer version of base image
    - rm: Remove intermediate containers
    - force_rm: Always remove intermediate containers
    - labels: Image labels
    - cache_from: Images to consider as cache sources
    - platforms: Target platforms for multi-platform builds
    - push: Push image after building
    - load: Load image to local Docker daemon
    - progress: Progress output type (auto, plain, tty)
    
    Returns:
    - Image object (if load=True)
    """

def legacy_build(
    context_path: str,
    *,
    tags: Optional[List[str]] = None,
    dockerfile: Optional[str] = None,
    build_args: Optional[Dict[str, str]] = None,
    target: Optional[str] = None,
    no_cache: bool = False,
    pull: bool = False,
    rm: bool = True,
    force_rm: bool = False,
    labels: Optional[Dict[str, str]] = None,
    cache_from: Optional[List[str]] = None
) -> Image:
    """
    Build image using legacy docker build.
    
    Parameters: Same as build() but without buildx-specific options
    
    Returns:
    - Image object
    """

Image Listing and Inspection

List and inspect images with filtering and detailed information retrieval.

def list(
    repository_name: Optional[str] = None,
    *,
    all: bool = False,
    filters: Optional[Dict[str, str]] = None,
    quiet: bool = False,
    no_trunc: bool = False,
    digests: bool = False
) -> List[Image]:
    """
    List images.
    
    Parameters:
    - repository_name: Filter by repository name
    - all: Show all images (including intermediate)
    - filters: Filters to apply (dangling, label, etc.)
    - quiet: Only show image IDs
    - no_trunc: Don't truncate output
    - digests: Show image digests
    
    Returns:
    - List of Image objects
    """

def inspect(image: str) -> Image:
    """
    Get detailed information about an image.
    
    Parameters:
    - image: Image name, ID, or digest
    
    Returns:
    - Image object with full details
    """

def exists(image: str) -> bool:
    """
    Check if image exists locally.
    
    Parameters:
    - image: Image name, ID, or digest
    
    Returns:
    - True if image exists, False otherwise
    """

Image History and Analysis

View image layer history and analyze image composition.

def history(
    image: str,
    *,
    human: bool = True,
    quiet: bool = False,
    no_trunc: bool = False
) -> List[Dict[str, Any]]:
    """
    Show image layer history.
    
    Parameters:
    - image: Image name, ID, or digest
    - human: Human readable sizes
    - quiet: Only show image IDs
    - no_trunc: Don't truncate output
    
    Returns:
    - List of layer information dictionaries
    """

Image Manipulation

Tag, save, load, and import images.

def tag(
    source_image: str,
    target_repository: str,
    target_tag: Optional[str] = None
) -> None:
    """
    Create tag for image.
    
    Parameters:
    - source_image: Source image name or ID
    - target_repository: Target repository name
    - target_tag: Target tag (defaults to 'latest')
    """

def save(
    images: Union[str, List[str]],
    output_path: str
) -> None:
    """
    Save images to tar archive.
    
    Parameters:
    - images: Image name(s) or ID(s)
    - output_path: Output tar file path
    """

def load(input_path: str, quiet: bool = False) -> List[str]:
    """
    Load images from tar archive.
    
    Parameters:
    - input_path: Input tar file path
    - quiet: Suppress load output
    
    Returns:
    - List of loaded image names
    """

def import_(
    source: str,
    repository: Optional[str] = None,
    tag: Optional[str] = None,
    message: Optional[str] = None,
    changes: Optional[List[str]] = None
) -> Image:
    """
    Import image from tarball or URL.
    
    Parameters:
    - source: Source tarball path or URL
    - repository: Repository name for imported image
    - tag: Tag for imported image
    - message: Commit message
    - changes: Dockerfile instructions to apply
    
    Returns:
    - Image object
    """

Image Cleanup

Remove images and clean up unused images.

def remove(
    images: Union[str, List[str]],
    *,
    force: bool = False,
    no_prune: bool = False
) -> None:
    """
    Remove images.
    
    Parameters:
    - images: Image name(s), ID(s), or digest(s)
    - force: Force removal of image
    - no_prune: Don't delete untagged parents
    """

def prune(
    *,
    all: bool = False,
    filters: Optional[Dict[str, str]] = None
) -> Dict[str, Any]:
    """
    Remove unused images.
    
    Parameters:
    - all: Remove all unused images, not just dangling ones
    - filters: Filters to apply
    
    Returns:
    - Information about removed images
    """

File Operations

Copy files between images and host filesystem.

def copy_from(
    image: str,
    source_path: str,
    destination_path: str
) -> None:
    """
    Copy files from image to host.
    
    Parameters:
    - image: Image name or ID
    - source_path: Source path in image
    - destination_path: Destination path on host
    """

def copy_to(
    source_path: str,
    image: str,
    destination_path: str
) -> None:
    """
    Copy files from host to image (creates new layer).
    
    Parameters:
    - source_path: Source path on host
    - image: Target image name or ID
    - destination_path: Destination path in image
    """

Types

class Image:
    id: str
    repo_tags: List[str]
    repo_digests: List[str]
    parent: str
    comment: str
    created: str
    container: str
    docker_version: str
    author: str
    config: Dict[str, Any]
    architecture: str
    os: str
    size: int
    virtual_size: int
    graph_driver: Dict[str, Any]
    root_fs: Dict[str, Any]
    metadata: Dict[str, Any]
    
    def remove(self, force: bool = False, no_prune: bool = False) -> None: ...
    def tag(self, repository: str, tag: Optional[str] = None) -> None: ...
    def save(self, output_path: str) -> None: ...
    def copy_from(self, source_path: str, destination_path: str) -> None: ...
    def copy_to(self, source_path: str, destination_path: str) -> None: ...
    def history(self, human: bool = True, quiet: bool = False, no_trunc: bool = False) -> List[Dict[str, Any]]: ...
    def exists(self) -> bool: ...

Install with Tessl CLI

npx tessl i tessl/pypi-python-on-whales

docs

build.md

client.md

compose.md

config.md

containers.md

context.md

images.md

index.md

manifest.md

networks.md

node.md

plugin.md

pod.md

secret.md

service.md

stack.md

swarm.md

system.md

task.md

trust.md

volumes.md

tile.json