CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-docker

A Python library for the Docker Engine API.

Pending
Overview
Eval results
Files

config-secrets.mddocs/

Configuration and Secrets

Docker configuration and secret management for secure credential handling and application configuration with support for external secret stores and configuration templating.

Capabilities

ConfigCollection

class ConfigCollection:
    def create(self, **kwargs):
        """
        Create a configuration.
        
        Args:
            **kwargs: Config options
            
        Returns:
            Config: Created config instance
            
        Common kwargs:
            name (str): Config name
            data (bytes): Config data  
            labels (dict): Config labels
            templating (dict): Template configuration
        """

    def get(self, config_id):
        """
        Get a config by ID or name.
        
        Args:
            config_id (str): Config ID or name
            
        Returns:
            Config: Config instance
        """

    def list(self, filters=None):
        """
        List configs.
        
        Args:
            filters (dict): Filter results
            
        Returns:
            list[Config]: List of config instances
        """

SecretCollection

class SecretCollection:
    def create(self, **kwargs):
        """
        Create a secret.
        
        Args:
            **kwargs: Secret options
            
        Returns:
            Secret: Created secret instance
            
        Common kwargs:
            name (str): Secret name
            data (bytes): Secret data
            labels (dict): Secret labels
            driver (dict): Secret driver configuration
        """

    def get(self, secret_id):
        """
        Get a secret by ID or name.
        
        Args:
            secret_id (str): Secret ID or name
            
        Returns:
            Secret: Secret instance
        """

    def list(self, filters=None):
        """
        List secrets.
        
        Args:
            filters (dict): Filter results
            
        Returns:
            list[Secret]: List of secret instances
        """

Config and Secret Models

class Config:
    """
    A Docker config instance.
    
    Properties:
        id (str): Config ID
        name (str): Config name
        attrs (dict): Raw config attributes
    """

    def remove(self):
        """Remove the config."""

class Secret:
    """
    A Docker secret instance.
    
    Properties:
        id (str): Secret ID
        name (str): Secret name
        attrs (dict): Raw secret attributes
    """

    def remove(self):
        """Remove the secret."""

Usage Examples

import docker

client = docker.from_env()

# Create config
config_data = b'server { listen 80; location / { proxy_pass http://app:3000; } }'
config = client.configs.create(
    name='nginx-config',
    data=config_data,
    labels={'app': 'web-proxy'}
)

# Create secret
secret_data = b'my-secret-password'
secret = client.secrets.create(
    name='db-password',
    data=secret_data
)

# Use in service
service = client.services.create(
    image='nginx:latest',
    name='web-proxy',
    configs=[{
        'ConfigID': config.id,
        'ConfigName': 'nginx-config',
        'File': {'Name': '/etc/nginx/nginx.conf', 'Mode': 0o644}
    }],
    secrets=[{
        'SecretID': secret.id,
        'SecretName': 'db-password',
        'File': {'Name': '/run/secrets/db_password', 'Mode': 0o600}
    }]
)

Install with Tessl CLI

npx tessl i tessl/pypi-docker

docs

client-management.md

config-secrets.md

container-management.md

context-management.md

error-handling.md

image-management.md

index.md

network-management.md

plugin-management.md

swarm-services.md

system-events.md

volume-management.md

tile.json