podman-compose icon indicating copy to clipboard operation
podman-compose copied to clipboard

Add subpath support to volumes with type volume in `--mount` option

Open fccagou opened this issue 1 month ago • 2 comments

To allow subpath mount as describes in Compose Specs, in complement of #1336

Compose entries exemple:

- type: volume source: webservices target: /srv/www/vhosts/server1 read_only: true volume: subpath: server1
- type: volume source: webservices target: /srv/www/vhosts/server2 read_only: true volume: subpath: server2
- type: volume source: webservices target: /srv/www/vhosts/server2/uploads read_only: false volume: subpath: server2/uploads

Runs podman with options

--mount type=volume,source=webservices,target=/srv/www/vhosts/server1,ro
--mount type=volume,source=webservices,target=/srv/www/vhosts/server2,ro,subpath=server2
--mount type=volume,source=webservices,target=/srv/www/vhosts/server2/uploads,subpath=server2/uploads

Contributor Checklist:

If this PR adds a new feature that improves compatibility with docker-compose, please add a link to the exact part of compose spec that the PR touches.

For any user-visible change please add a release note to newsfragments directory, e.g. newsfragments/my_feature.feature. See newsfragments/README.md for more details.

All changes require additional unit tests.

fccagou avatar Dec 07 '25 17:12 fccagou

The test added is finally removed because get_mount_args calls assert_volume which fails running podman inspect volume xxxx. In the testcase contexte, this returns unexpected NoneType then break calling .decode("utf-8") podman_compose.py:430

fccagou avatar Dec 09 '25 21:12 fccagou

Tests can still be added for mount_desc_to_mount_args. As for get_mount_args, would it be possible to patch assert_volume to do nothing for test?

p12tic avatar Dec 10 '25 00:12 p12tic

@p12tic, I just add the unittests and modify podman_compose.py to get it working.

fccagou avatar Dec 13 '25 12:12 fccagou

Hum, my commits messages have typo ... I change them ...

fccagou avatar Dec 13 '25 12:12 fccagou

Hi there. Apart from time, is there anything else missing for merging ?

Have a nice Christmas week everyone :)

fccagou avatar Dec 21 '25 16:12 fccagou