@@ -459,6 +459,7 @@ def mount_desc_to_mount_args(mount_desc: dict[str, Any]) -> str:
459459 vol = mount_desc .get ("_vol" ) if mount_type == "volume" else None
460460 source = vol ["name" ] if vol else mount_desc .get ("source" )
461461 target = mount_desc ["target" ]
462+ volume = mount_desc .get ("volume" ) if mount_type == "volume" else None
462463 opts = []
463464 if mount_desc .get (mount_type , None ):
464465 # TODO: we might need to add mount_dict[mount_type]["propagation"] = "z"
@@ -480,6 +481,11 @@ def mount_desc_to_mount_args(mount_desc: dict[str, Any]) -> str:
480481 selinux = bind_opts .get ("selinux" )
481482 if selinux is not None :
482483 opts .append (selinux )
484+ else :
485+ if volume is not None :
486+ subpath = volume .get ("subpath" )
487+ if subpath is not None :
488+ opts .append (f"subpath={ subpath } " )
483489 opts_str = "," .join (opts )
484490 if mount_type == "bind" :
485491 return f"type=bind,source={ source } ,destination={ target } ,{ opts_str } " .rstrip ("," )
@@ -1186,7 +1192,6 @@ async def container_to_args(
11861192 podman_args .extend (["--tmpfs" , i ])
11871193 for volume in cnt .get ("volumes" , []):
11881194 podman_args .extend (await get_mount_args (compose , cnt , volume ))
1189-
11901195 await assert_cnt_nets (compose , cnt )
11911196 podman_args .extend (get_net_args (compose , cnt ))
11921197
@@ -2064,7 +2069,7 @@ def __init__(self) -> None:
20642069 self .container_by_name : dict [str , Any ]
20652070 self .services : dict [str , Any ]
20662071 self .all_services : set [Any ] = set ()
2067- self .prefer_volume_over_mount = True
2072+ self .prefer_volume_over_mount = False
20682073 self .x_podman : dict [PodmanCompose .XPodmanSettingKey , Any ] = {}
20692074 self .merged_yaml : Any
20702075 self .yaml_hash = ""
0 commit comments