@@ -46,6 +46,7 @@ def from_docker_image(
4646 cls : Type [EnvClientT ],
4747 image : str ,
4848 provider : Optional ["ContainerProvider" ] = None ,
49+ ** kwargs : Any ,
4950 ) -> EnvClientT :
5051 """
5152 Create an environment client by spinning up a Docker container locally.
@@ -61,6 +62,8 @@ def from_docker_image(
6162 Args:
6263 image: Docker image name to run (e.g., "echo-env:latest")
6364 provider: Container provider to use (defaults to LocalDockerProvider)
65+ **kwargs: Additional arguments to pass to provider.start_container()
66+ (e.g., env_vars, port)
6467
6568 Returns:
6669 An instance of the client class connected to the running container
@@ -72,6 +75,12 @@ def from_docker_image(
7275 >>> # Create environment from image
7376 >>> env = CodingEnv.from_docker_image("coding-env:latest")
7477 >>>
78+ >>> # Create environment with custom env vars
79+ >>> env = CodingEnv.from_docker_image(
80+ ... "coding-env:latest",
81+ ... env_vars={"MY_VAR": "value"}
82+ ... )
83+ >>>
7584 >>> # Use the environment
7685 >>> result = env.reset()
7786 >>> print(result.observation)
@@ -87,8 +96,8 @@ def from_docker_image(
8796 if provider is None :
8897 provider = LocalDockerProvider ()
8998
90- # 1. Start container
91- base_url = provider .start_container (image )
99+ # 1. Start container with optional kwargs (e.g., env_vars, port)
100+ base_url = provider .start_container (image , ** kwargs )
92101
93102 # 2. Wait for server to be ready
94103 provider .wait_for_ready (base_url )
0 commit comments