Skip to content

A programming framework for agentic AI

Add kwargs to pass to docker container that runs the Jupyter Server (#3028)

rahulAira3c10dc56c5ae
diff --git a/autogen/coding/jupyter/docker_jupyter_server.py b/autogen/coding/jupyter/docker_jupyter_server.py
index 83455e272..e5896014a 100644
--- a/autogen/coding/jupyter/docker_jupyter_server.py
+++ b/autogen/coding/jupyter/docker_jupyter_server.py
@@ -8,7 +8,7 @@ import sys
import uuid
from pathlib import Path
from types import TracebackType
-from typing import Dict, Optional, Type, Union
+from typing import Any, Dict, Optional, Type, Union
import docker
@@ -59,6 +59,7 @@ WORKDIR "${HOME}"
stop_container: bool = True,
docker_env: Dict[str, str] = {},
token: Union[str, GenerateToken] = GenerateToken(),
+ **docker_kwargs: Any,
):
"""Start a Jupyter kernel gateway server in a Docker container.
@@ -77,6 +78,7 @@ WORKDIR "${HOME}"
token (Union[str, GenerateToken], optional): Token to use for authentication.
If GenerateToken is used, a random token will be generated. Empty string
will be unauthenticated.
+ docker_kwargs (Any): Additional keyword arguments to pass to the docker container.
"""
if container_name is None:
container_name = f"autogen-jupyterkernelgateway-{uuid.uuid4()}"
@@ -118,6 +120,7 @@ WORKDIR "${HOME}"
environment=env,
publish_all_ports=True,
name=container_name,
+ **docker_kwargs,
)
_wait_for_ready(container)
container_ports = container.ports