Camel.runtime.ubuntu docker runtime
UbuntuDockerRuntime
A specialized Docker runtime for Ubuntu-based environments.
This runtime includes specific configurations and setup for Ubuntu containers, including proper Python path handling and environment setup. It provides methods for executing Python files, managing the container lifecycle, and handling file operations within the Ubuntu container.
Attributes: python_path (str): Path to the Python interpreter in the container docker_config (dict): Configuration dict for Docker container setup
init
Initialize the Ubuntu Docker Runtime.
Parameters:
- image (str): Docker image name to use
- port (int, optional): Port to expose. Defaults to 0 (random port) (default: 0 (random port)
- remove (bool, optional): Whether to remove container after use. Defaults to True
- python_path (str, optional): Path to Python interpreter. Defaults to “/usr/bin/python3” **kwargs: Additional arguments passed to DockerRuntime
add
Add functions to the runtime with Ubuntu-specific modifications.
Returns:
Self for method chaining
_setup_default_mounts
Setup default volume mounts for the container.
This method can be extended to add Ubuntu-specific volume mounts.
build
Build and initialize the Ubuntu container with proper setup.
Parameters:
- time_out (int): Timeout in seconds for build operation
Returns:
Self for method chaining
exec_python_file
Execute a Python file inside the Docker container.
Parameters:
- env: Additional environment variables to set for the execution
- callback: Optional function to process each line of output If None, output is printed to stdout
_create_archive_from_file
Create a tar archive from a single file for docker.put_archive().
Parameters:
- file_path: Path to the file to archive
Returns:
bytes: The tar archive as bytes