-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
"podman volume rm" behaviour #23943
Comments
I agree this is an issue and we should not be removing volumes this way. @mheon PTAL |
I would have to double-check, but I believe this is a duplicate of Docker behavior, and as such I don't think we can change it. And even if we could, I'm not sure we should. If you were two have two volumes, |
The issue is if you only have one volume named abc, and do |
Only once |
Yup, but I find that surprising and likely to cause volumes to be removed by accident. |
And I see little upside in this other then perhaps Docker does it this way. As the reporter states it easy enough to do |
Docker has different behaviour
Tested with docker 27.1.2 More info about the system: Click me
|
this seems valid then ... lets tidy it up ? |
Could still be considered a breaking change since we're altering behvaior on |
Well other commands behave sort of similar with partial ids. The difference in volume is that there is only one Name field and not Name and ID as separate things so the logic here got conflated into the same things which is not nice. Of course if there is an exact match we must remove that is clear but if docker doesn't remove partial name matches then I think we should not either. Although I would compare this behavior against an actual ID (anonymous volume). As far as breaking people, I am not sure that happens much in practice. Scripts should use the full name anyway and would need to get out of their way to rely on the partial lookup and for interactive use shell completion should be good enough. |
Apologies if this isn't the place to ask, but would this be a good beginner issue? I'm interested to look into it if it isn't already being worked on by someone else. |
@zackattackz You can try for sure, I don't think it is to easy as you have to find the right places where to logic applies and the compare this against the docker behavior but it should not be super difficult either I guess. |
@Luap99 |
PR made at #24027 |
This commit reverts the behavior of allowing volume removal by partial name in favor of requiring the exact name. It does this by favoring usage of `GetVolume` over `LookupVolume` In the past, issue containers#3891 was raised to allow partial name matching on `podman volume rm`, which was fixed by PR containers#3896. However, it has been determined in issue containers#23943 that the pros of allowing removal by partial name (less keys to type) are outweighed by the cons (possibility of unintentionally deleting a volume you didn't mean to). So the behavior will be reverted. Since PR containers#3896, there has also been PR containers#4832 and PR containers#6736, which extended the partial name removal behavior to API endpoints. This commit also makes these endpoints require exact names. Closes containers#23943 Signed-off-by: Zachary Hanham <[email protected]>
A friendly reminder that this issue had no activity for 30 days. |
Discussed in #23922
Originally posted by tokudan September 10, 2024
I've been very surprised by the unpredictable behaviour of the podman volume rm command.
It boils down to this:
Podman deletes the volume "xa". Obviously this is a constructed example, but in practice, just running "podman volume rm x" again if you're were interrupted and not sure if you already did it, probably happens.
The function of the "rm" command is so obvious that I don't actually look up the manpage if I don't want some special behaviour. The manpage actually documents that behaviour:
I think guessing what a user wants to delete is pretty dangerous and makes it unpredictable.
If I copy a volume to backup its contents, I cannot give it a similar name as "forgejo-backup" could be removed, because I run "podman rm forgejo". Am I sure no automatic process has removed the production volume while I was busy? Are there any automatic cleanup jobs running, that might cause me to remove the backup instead of the volume I specify?
/bin/rm removes exactly what you tell it to remove. Which is obviously were "podman volume rm" got its name.
I believe "podman volume rm" should behave the same, at least by default.
The guesswork that "podman volume rm" is doing probably saved someone some keystrokes. I'd argue that's the point of tab completion, but I think the guesswork should be opt-in.
The text was updated successfully, but these errors were encountered: