Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple volume paths. #24329

Open
peter-facko opened this issue Oct 21, 2024 · 5 comments
Open

Multiple volume paths. #24329

peter-facko opened this issue Oct 21, 2024 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@peter-facko
Copy link

peter-facko commented Oct 21, 2024

Feature request description

Recently I added a new RAID to my server and want to migrate some volumes to it.
My project uses podman-compose with multiple volumes declared: some volumes are for caching only, others hold the database data.

I want to migrate the database volumes to the RAID. Cache volumes can stay in the home directory because cache data is not critical and I don't want it to waste the RAID disks. The backing location of volumes is the only setting I am interested in changing, everything else should be managed by podman.

The current declaration is:

volumes:
    cache:
    database:

Suggest potential solution

Change the volumes_path setting to support a dictionary of labels to paths and then allow an option during volume creation to specify the path label the volume should use. One label (path) would be the default one, for example, the first one or explicitly declared as default.

Then I could specify

volumes_path = {"home": "/home/peter/", "RAID": "/mnt/RAID/"}
volumes:
    cache:
        path_label: home
    database:
        path_label: RAID

Have you considered any alternatives?

Changing volumes_path would change all volume locations.

Using bind mounts works, but I want podman to manage the volumes. No data is expected to be present in the location when the container starts and I don't need to interact with the volume as a directory outside the container.

Additional context

No response

@peter-facko peter-facko added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 21, 2024
@Luap99
Copy link
Member

Luap99 commented Oct 22, 2024

Note we are not podman-compose nor support it directly. So whatever syntax is used there is completely relevant here.
As such the import question is how would this look with actual podman commands?

I don't see why this would be needed over actual bind mounts? By the time you have to select a "path_label" you might as well just specify a full directory, no?
I really do not see much value in this and it just adds extra complexity to podman and our tests

@peter-facko
Copy link
Author

Thank you for the response.

I am sorry, I didn't realize podman-compose was not part of the podman project.

Using volumes "just works" with podman

podman run --volume grafana:/var/lib/grafana docker.io/grafana/grafana:latest

, whereas

podman run --mount type=bind,source=/mnt/RAID/peter/volumes/grafana/,target=/var/lib/grafana docker.io/grafana/grafana:latest

gives a permission error.

I am sure I can somehow make it work with bind mounts as well, but doesn't the argument of volumes' ease of use translate to this use case as well? I don't care about the directory outside the container; I just want it placed under some path prefix. Except I have two such prefixes.

@peter-facko
Copy link
Author

And I forgot the volume command I imagine:

podman volume create --path-label RAID myproject_grafana

@Luap99
Copy link
Member

Luap99 commented Oct 22, 2024

podman run --mount type=bind,source=/mnt/RAID/peter/volumes/grafana/,target=/var/lib/grafana docker.io/grafana/grafana:latest

gives a permission error.

you likely need to set Z,U as options

I am sure I can somehow make it work with bind mounts as well, but doesn't the argument of volumes' ease of use translate to this use case as well? I don't care about the directory outside the container; I just want it placed under some path prefix. Except I have two such prefixes.

Well yes of course there is a use case but fundamentally I don't think it is strong enough given normal bind mounts already allow this even if it is bit longer to setup. But by the time we add path-label syntax it is properly not much longer.

Overall I just think this adds extra complexity into podman that I do not wish to maintain but maybe other maintainers see it differently and like this.

@baude
Copy link
Member

baude commented Oct 30, 2024

i agree with @Luap99 ... I wonder if the reporter should file an issue with containers/podman-compose ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

3 participants