Skip to content

Commit da088d3

Browse files
committed
fix(volumes): manage subpath into volume
Force refer_volume_over_mount to false and add code to add subpath option in podman command line. Signed-off-by: fccagou <[email protected]>
1 parent a1f3bef commit da088d3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

podman_compose.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ def mount_desc_to_mount_args(mount_desc: dict[str, Any]) -> str:
480480
selinux = bind_opts.get("selinux")
481481
if selinux is not None:
482482
opts.append(selinux)
483+
else:
484+
subpath = mount_desc.get("subpath")
485+
if subpath is not None:
486+
opts.append(f"subpath={subpath}")
483487
opts_str = ",".join(opts)
484488
if mount_type == "bind":
485489
return f"type=bind,source={source},destination={target},{opts_str}".rstrip(",")
@@ -1186,7 +1190,6 @@ async def container_to_args(
11861190
podman_args.extend(["--tmpfs", i])
11871191
for volume in cnt.get("volumes", []):
11881192
podman_args.extend(await get_mount_args(compose, cnt, volume))
1189-
11901193
await assert_cnt_nets(compose, cnt)
11911194
podman_args.extend(get_net_args(compose, cnt))
11921195

@@ -2064,7 +2067,7 @@ def __init__(self) -> None:
20642067
self.container_by_name: dict[str, Any]
20652068
self.services: dict[str, Any]
20662069
self.all_services: set[Any] = set()
2067-
self.prefer_volume_over_mount = True
2070+
self.prefer_volume_over_mount = False
20682071
self.x_podman: dict[PodmanCompose.XPodmanSettingKey, Any] = {}
20692072
self.merged_yaml: Any
20702073
self.yaml_hash = ""

0 commit comments

Comments
 (0)