> ## Documentation Index
> Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Camel.runtimes.ubuntu docker runtime

<a id="camel.runtimes.ubuntu_docker_runtime" />

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime" />

## UbuntuDockerRuntime

```python theme={"system"}
class UbuntuDockerRuntime(DockerRuntime):
```

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.

**Parameters:**

* **python\_path** (str): Path to the Python interpreter in the container
* **docker\_config** (dict): Configuration dict for Docker container setup

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime.__init__" />

### **init**

```python theme={"system"}
def __init__(
    self,
    image: str,
    port: int = 0,
    remove: bool = True,
    python_path: str = '/usr/bin/python3',
    **kwargs
):
```

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

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime.add" />

### add

```python theme={"system"}
def add(
    self,
    funcs: Union[FunctionTool, List[FunctionTool]],
    entrypoint: str,
    redirect_stdout: bool = False,
    arguments: Optional[dict] = None
):
```

Add functions to the runtime with Ubuntu-specific modifications.

**Returns:**

Self for method chaining

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime._setup_default_mounts" />

### \_setup\_default\_mounts

```python theme={"system"}
def _setup_default_mounts(self):
```

Setup default volume mounts for the container.

This method can be extended to add Ubuntu-specific volume mounts.

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime.build" />

### build

```python theme={"system"}
def build(self, time_out: int = 15):
```

Build and initialize the Ubuntu container with proper setup.

**Parameters:**

* **time\_out** (int): Timeout in seconds for build operation

**Returns:**

Self for method chaining

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime.exec_python_file" />

### exec\_python\_file

```python theme={"system"}
def exec_python_file(
    self,
    local_file_path: str,
    container_path: Optional[str] = None,
    args: Optional[List[str]] = None,
    env: Optional[dict] = None,
    callback: Optional[Callable[[str], None]] = None
):
```

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

<a id="camel.runtimes.ubuntu_docker_runtime.UbuntuDockerRuntime._create_archive_from_file" />

### \_create\_archive\_from\_file

```python theme={"system"}
def _create_archive_from_file(self, file_path: Union[str, Path]):
```

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
