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

manifest.mddocs/

Manifest Management

Docker manifest list management for multi-architecture image support. Manifests enable creating and managing platform-specific image variants, allowing a single image name to reference different implementations for different architectures and operating systems.

Capabilities

Manifest Creation

Create manifest lists that reference multiple platform-specific images.

def create(
    name: str,
    manifests: List[str],
    *,
    amend: bool = False,
    insecure: bool = False
) -> ManifestList:
    """
    Create a manifest list.
    
    Parameters:
    - name: Name for the manifest list
    - manifests: List of manifest/image references to include
    - amend: Modify existing manifest list if it exists
    - insecure: Allow insecure registry connections
    
    Returns:
    ManifestList object
    """

Manifest Annotation

Annotate manifests with platform-specific metadata.

def annotate(
    name: str,
    manifest: str,
    *,
    arch: Optional[str] = None,
    os: Optional[str] = None,
    os_features: Optional[List[str]] = None,
    os_version: Optional[str] = None,
    variant: Optional[str] = None
) -> None:
    """
    Annotate a manifest with platform information.
    
    Parameters:
    - name: Manifest list name
    - manifest: Manifest to annotate
    - arch: Architecture (e.g., amd64, arm64, arm, 386)
    - os: Operating system (e.g., linux, windows, darwin)
    - os_features: OS features list
    - os_version: OS version
    - variant: Architecture variant (e.g., v6, v7, v8 for ARM)
    """

Manifest Inspection

Inspect manifest list details and constituent manifests.

def inspect(x: Union[str, ManifestList]) -> ManifestList:
    """
    Inspect a manifest list.
    
    Parameters:
    - x: Manifest list name or ManifestList object
    
    Returns:
    ManifestList object with detailed information
    """

Manifest Publishing

Push manifest lists to registries.

def push(
    x: Union[str, ManifestList],
    *,
    purge: bool = False,
    quiet: bool = False
) -> None:
    """
    Push manifest list to registry.
    
    Parameters:
    - x: Manifest list name or ManifestList object
    - purge: Remove local manifest list after push
    - quiet: Suppress progress output
    """

Manifest Removal

Remove manifest lists from local storage.

def remove(manifest_lists: Union[str, List[str]]) -> None:
    """
    Remove one or more manifest lists.
    
    Parameters:
    - manifest_lists: Manifest list name(s) to remove
    """

Usage Examples:

from python_on_whales import docker

# First, build and push platform-specific images
# docker buildx build --platform linux/amd64 -t myapp:amd64 --push .
# docker buildx build --platform linux/arm64 -t myapp:arm64 --push .
# docker buildx build --platform linux/arm/v7 -t myapp:armv7 --push .

# Create manifest list
manifest = docker.manifest.create(
    "myregistry.com/myapp:latest",
    [
        "myregistry.com/myapp:amd64",
        "myregistry.com/myapp:arm64", 
        "myregistry.com/myapp:armv7"
    ]
)

# Annotate manifests with platform info
docker.manifest.annotate(
    "myregistry.com/myapp:latest",
    "myregistry.com/myapp:amd64",
    arch="amd64",
    os="linux"
)

docker.manifest.annotate(
    "myregistry.com/myapp:latest",
    "myregistry.com/myapp:arm64",
    arch="arm64", 
    os="linux"
)

docker.manifest.annotate(
    "myregistry.com/myapp:latest",
    "myregistry.com/myapp:armv7",
    arch="arm",
    os="linux",
    variant="v7"
)

# Inspect manifest list
manifest_details = docker.manifest.inspect("myregistry.com/myapp:latest")
print(f"Manifest: {manifest_details.name}")
print(f"Schema Version: {manifest_details.schema_version}")
for i, m in enumerate(manifest_details.manifests):
    print(f"  Platform {i+1}: {m.platform.architecture}/{m.platform.os}")

# Push manifest list to registry
docker.manifest.push("myregistry.com/myapp:latest")

# Remove local manifest list
docker.manifest.remove("myregistry.com/myapp:latest")

Types

class ManifestList:
    name: str
    schema_version: int
    media_type: str
    manifests: List[ManifestDescriptor]
    
    def remove(self) -> None:
        """Remove this manifest list."""

class ManifestDescriptor:
    media_type: str
    size: int
    digest: str
    platform: Platform

class Platform:
    architecture: str
    os: str
    os_version: Optional[str]
    os_features: Optional[List[str]]
    variant: Optional[str]
    features: Optional[List[str]]

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