@@ -249,6 +249,10 @@ class DockerDeployer(Deployer):
249249 """
250250 Client for interacting with the Docker daemon.
251251 """
252+ _container_ephemeral_files_dir : Path | None = None
253+ """
254+ Directory for ephemeral files inside containers, internal use only.
255+ """
252256 _mutate_create_options : Callable [[dict [str , Any ]], dict [str , Any ]] | None = None
253257 """
254258 Function to handle mirrored deployment, internal use only.
@@ -643,8 +647,8 @@ def _create_unhealthy_restart_container(
643647 else :
644648 return d_container
645649
646- @staticmethod
647650 def _append_container_mounts (
651+ self ,
648652 create_options : dict [str , Any ],
649653 c : Container ,
650654 ci : int ,
@@ -670,7 +674,7 @@ def _append_container_mounts(
670674 continue
671675 fn = ephemeral_filename_mapping [(ci , f .path )]
672676 path = str (
673- envs . GPUSTACK_RUNTIME_DOCKER_EPHEMERAL_FILES_DIR .joinpath (fn ),
677+ self . _container_ephemeral_files_dir .joinpath (fn ),
674678 )
675679 binding ["Source" ] = path
676680 binding ["Target" ] = f"/{ f .path .lstrip ('/' )} "
@@ -1049,6 +1053,9 @@ def _start_containers(
10491053 def __init__ (self ):
10501054 super ().__init__ (_NAME )
10511055 self ._client = self ._get_client ()
1056+ self ._container_ephemeral_files_dir = (
1057+ envs .GPUSTACK_RUNTIME_DOCKER_EPHEMERAL_FILES_DIR
1058+ )
10521059
10531060 def _prepare_create (self ):
10541061 """
@@ -1284,6 +1291,22 @@ def mutate_create_options(create_options: dict[str, Any]) -> dict[str, Any]:
12841291
12851292 self ._mutate_create_options = mutate_create_options
12861293
1294+ # Extract ephemeral files dir mutation if any.
1295+ container_ephemeral_files_dir_str = str (
1296+ envs .GPUSTACK_RUNTIME_DOCKER_EPHEMERAL_FILES_DIR ,
1297+ )
1298+ if mirrored_mounts :
1299+ for m in mirrored_mounts :
1300+ if m .get ("Type" , "volume" ) != "volume" :
1301+ continue
1302+ target = f"{ m .get ('Destination' , '///' )} /"
1303+ if not container_ephemeral_files_dir_str .startswith (target ):
1304+ continue
1305+ source = m .get ("Source" )
1306+ subpath = container_ephemeral_files_dir_str .removeprefix (target )
1307+ self ._container_ephemeral_files_dir = Path (source ).joinpath (subpath )
1308+ break
1309+
12871310 @_supported
12881311 def _create (self , workload : WorkloadPlan ):
12891312 """
0 commit comments