pawnlib.docker package
from pawnlib.docker import *
Submodules
pawnlib.docker.async_docker module
from pawnlib.docker import async_docker
pawnlib.docker.compose module
from pawnlib.docker import compose
- class DockerComposeBuilder(compose_file='docker-compose.yml')[source]
Bases:
objectA class to build and manage Docker Compose files interactively.
- Parameters:
compose_file (optional) – Name of the Docker Compose file to be created or modified (default: “docker-compose.yml”). |default|
'docker-compose.yml'
Example
dcb = DockerComposeBuilder() dcb.create_docker_compose() # Starts an interactive session to create a Docker Compose file. dcb.save_docker_compose() # Saves the created Docker Compose data to a file. data = dcb.get_docker_compose_data() # Returns the Docker Compose data as a dictionary. dcb.remove_service() # Removes a service from the Docker Compose configuration.
- confirm_with_min_once(message, already_asked)[source]
Set the default value to ‘yes’ at least once, and then set it to ‘no’ afterwards.
- get_valid_input(message, default=None)[source]
Get valid non-empty input from the user, validate the input.
- get_volumes(default_volume='./data:/data')[source]
Get volume mappings from the user and validate the format.
- is_valid_volume_mapping(volume)[source]
Validate volume mapping format (e.g., ./data:/app/data)