-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
[Feature request] Dry run mode for prune commands #30623
Comments
I would like to try implementing that. #dibs |
@jphuynh If you're not working on this, can I pick this up? |
@jphuynh Is it okay that I work on this? |
Hiya. Yes sorry I've been willing to work on this but it would take me quite some time. I'm happy for someone else to take it as I won't have much time in the next few weeks. |
Thank you! |
I like dry-run... the original design had a "preview" of what would happen and "would you like to continue", the problem with such an approach is that it is racey. I think something like ping @mlaventure WDYT? |
I agree, as long as we clearly communicate / document that it may be an approximation, I think it would be a nice addition |
SGTM, didn't put back the preview when moving the pruning to the daemon side because I was trying to get mostly accurate data. If we don't mind some inaccuracy (especially when images are concerned), it should be easy to add |
Hey @chaynika, |
I have been little busy so did not get a chance yet. Yes definitely, help
would be appreciated
…On 15 March 2017 at 05:42, bshuster ***@***.***> wrote:
Hey @chaynika <https://github.com/chaynika>,
Did you get the chance to work on this?
Do you want some help?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#30623 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARTOOoAL1jfk-4uKmQEFxCuDHHsDsfeGks5rl9y5gaJpZM4LzmQS>
.
--
Regards,
Chaynika Saikia
|
@chaynika - in I guess you should think of a way that doesn't really remove the resources (hint: to skip this line f.e.) but just print the results. The common way to do so, probably, is transforming the I hope it helps. |
@chaynika any progress? 😉 |
@ripcurld0 May I work on this task?
So far, I've added a Update: #dibs 😉 |
@adhulipa 👍 😉 |
Hi @ripcurld0 -- a quick update. I've implemented a bare-bones version of the dry-run for volumes prune.
|
Anyway, if you're afraid someone will "hijack" this from you, I can understand you but we're playing nice here so I think you should send your pull request once you have at least something that's working (unit-tests can come later although it is preferable to have them alongside with the code changes). I hope I answered your questions right. |
Yes, opening a "WIP" PR is fine, but don't open too early if it's really in an early stage yet. You can push a branch to your repo and post a link to that here |
Thank you @ripcurld0 & @thaJeztah :)
|
Update: This can be accessed via Pruning images seems to be a little more involved. |
Update:
|
Looks like image pruning is harder than I expected. Do you think it makes sense to break this task into:
if yes, then may I create new sub-issues and open pull requests for each sub task? |
@adhulipa ping: any news? 😃 |
Hi @ripcurld0 I will provide more details and a link to my current stash later today (at 9PM PT). Since, it has been two weeks since my last comment, I will put image dry-pruning on hold and open pull requests for volume, network, container pruning. |
Perhaps it's acceptable to initially just list the images that will be removed (without size) (wondering) |
Two updates:
WIP patch: adhulipa@2d54746 |
@cpuguy83 can you give me a small example of how to set up with the master? Because I tried compiling with the docker/cli but the |
The make script in this repo looks for |
@cpuguy83 sorry for late reply. Your reply helped me a lot. Now it seems to be working again. Not sure how I missed this. Will get back soon. Thanks so much. |
@cpuguy83 I made a CLI side base PR: docker/cli#2698. |
@cpuguy83 the check is failing for validation. Can you please help me how to fix it. I believe it doesn't have anything to do with moby. But may be I am doing a |
@cpuguy83 nvm I fixed it. Just had to pull from latest master for vendors update. |
@kaushik94 I respect you for your dedication and your hard work |
@peabnuts123 thanks. That means a lot. |
I am writing applications for college. So I will be busy for a couple of days. Will pick this up once that is done. |
any updates @kaushik94 ? |
@jhollowe yes I am working on this. Will try to push a commit by the day after tomorrow. |
Hi all, when I am trying to build the cli from this repository: docker/cli I am getting the following error:
Can someone please help me out here 🙏. I rebased my branch with the latest master. |
Ok I was using the wrong command. After |
Hi, so I managed to add commands for dry run for containers. Please find the PRs here: The previous PR for CLI changes had sign-off issues so I opened a new one. I did not write tests for this and I could not test this on another OS. I tried it on my laptop that has these specifications:
|
thank you for your work! Are tests the only thing left? |
@kaushik94 I figure you must be busy but do you have any updates? Looks like your PRs are still open but haven't been touched in a little bit. Hoping they make it in soon:) |
Hey, so I think writing tests for this case is pretty straightforward. But I am thinking about how to extend dry-run to images, networks, and volumes. Because for example in the case of networks we need to offer flexibility to extend it to external drivers. So I might need some help with that. As well as someone to who can spare some valuable time to review the PRs. Also a general question: Dry-run implementation for images etc can go into separate PRs or should I include them in a single PR? My opinion is to divide it into multiple PRs as it is better. So I am a bit stuck here. |
@kaushik94 i want to applaud you for the continued effort! 🙌🏾 I agree with your assessment. All those years ago, I found it reliably easy to get the tests and feature working for volumes iirc. Relatively the same for containers and networks too. But images really stumped me. I'd highly highly advise merging smaller units, perhaps whatever you have working (volumes etc) before tackling others that can get you stuck (images perhaps). |
Looking forward to this flag. Any updates on this? Did someone already work on this? |
Some initial work was done in;
However, that work only focussed on containers; having a more representative overview of what will be pruned will be quite complicated, for various reasons;
|
@thaJeztah yes, I initially thought in this direction. Basically copy over the whole table of images, and remove in the same fashion as for the I think I will be able to get the approximation done for images part. |
The dry run option is nice, but the issue from docker/cli#3742, I'd say that it goes further. Here you're offering the The reason? It's critical to know for real what you're accepting. Like if I decide to delete a package and (if I don't say different) all the dependencies will also be deleted, I see all the changes before I accept "yes, do as I say". But here, with the current system, you are blindly trusting docker. Not to mention Because even if you do a dry-run, because is not final, the final decision may be to delete something I don't expect (because of a bug) Like in my case, I lost all the volumes while containers were running and using them, causing a full system failure. |
The new
prune
commands are potentially dangerous and I find it hard to predict what actually would be deleted. The user might usedocker system df
anddocker image ls --filter dangling=true
to get to this information, but this seems like an unneccessary step.I propose to add a new operating mode where the normal output is produced without actually deleting the objects.
$ docker system prune --dry-run Warning: Running in dry run mode, not actually deleting anything. Deleted Volumes: dockerdev-go-pkg-cache-gopath dockerdev-go-pkg-cache-goroot-linux_amd64_netgo Total reclaimed space: 112.1 MB
The user could then decide to run the same command again without
--dry-run
.The text was updated successfully, but these errors were encountered: