-
Notifications
You must be signed in to change notification settings - Fork 18.8k
New Data Management commands #26108
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
New Data Management commands #26108
Conversation
lots of people have asked for this type of thing! nice! |
Very nice. I'm not sure if it's within the scope of this PR, but it would be cool to have some kind of tree view of which layers are used by which images. That would show how to reclaim space used by large layers. |
@aaronlehmann no, as a maintainer you are to never mention some type of "tree view" again ;) |
LOL i was wondering if someone was going to correct this egregious mistake :-) |
Might be a good idea to add an |
Design LGTM 👍 I have to say that I'm not a big fan of the output of |
So why not start it as a client side implementation first? As the |
nice, look good. nit: It is consistent for
|
391eeb6
to
ff12c26
Compare
Just to add some perspective on how to do the same $ # caveat that you get warnings on things that can't be removed
$ # remove all stopped containers
$ docker ps -aq | xargs --no-run-if-empty docker rm
$ # remove all unused volumes
$ docker volume ls -q | xargs --no-run-if-empty docker volume rm
$ # remove local volumes
$ docker volume ls | awk '/^local/ { print $2 }' | xargs --no-run-if-empty docker volume rm
$ # delete untagged images
$ docker images --filter dangling=true -q | xargs --no-run-if-empty docker rmi
$ # delete and untag every image that is not a container
$ # a little more heinous since "<none>" is the repo/tag for dangling images
$ docker images | awk 'NR>1 { if ($1 == "<none>") print $3; else print $1":"$2 }' | sort | xargs --no-run-if-empty docker rmi
$ # sort is not necessary but is nice if you add a -tn1 to xargs so you can see each rm line What about the volumes of stopped containers? Shouldn't the Should it be Should probably change It would also be help to have some sort of |
I think it's more natural if
This PR assumes that #26025 will be merged: you should look at that one for more context 😉
I agree, I'm pretty sure this will come in pretty fast once this one gets merged. Do you agree it's a solid starting point nevertheless, or do you feel it's missing something to be useful? |
Thanks @icecrime!
I am still on the fence as to whether this is strictly necessary, but I do see it being used. I am not a fan of the I feel like Edit: a non-aggressive prune on containers could only delete stopped containers that do not have a volume. Or maybe only successful exit codes. |
Ha, I didn't realize that there was indeed a significant difference between "dangling" and "not referenced by any container" in the context of images.
WDYT @mlaventure? |
I don't mind having it only removing dangling image by default. Finding the On Mon, Aug 29, 2016, 5:08 PM Arnaud Porterie notifications@github.com
|
Maybe People may face difficulty in running |
Maybe it is useful if there is |
I'm sure filtering will be a must have, but we need a starting point 😞 This looks to me as a PR we can build upon. Regarding networking, that's a good point. It would indeed make sense to implement |
Added:
|
bc710e7
to
7dbfbe1
Compare
Introduced in moby#26108 Signed-off-by: Ben Firshman <ben@firshman.co.uk>
I'm having issues with |
@mmlkrx the docker daemon on docker for Mac runs inside a VM with its own filesystem; running |
@thaJeztah Thanks for the quick reply, things make sense now :)! |
Why does it delete named volumes? Why not treat named volumes like named images? |
@michael-k there is no real distinction between This PR is only the start though, and we can add further enhancements (a |
Thanks for the explanation 👍 |
Just to clarify, which milestone is this scheduled for? I see it didn't make it into the 1.12.6 release, but is it on track for the 1.13.0 one? EDIT: Ah, I see it is in the 1.13.0 changelog. Great to see :) |
good |
New Data Management commands
This PR introduce a few new commands to help facilitate visualising how much space the docker daemon data is taking on disk and allowing for easily cleaning up "unneeded" excess.
docker system df
presents a summary of the space currently used by different docker objects:docker system df -v
expends on the previous with more details:docker system prune
will delete ALL unused data (i.e. In order: containers stopped, volumes without containers and images with no containers):docker container prune
will delete all stopped containers:docker volume prune
will delete all volume without associated containers:docker image prune
will delete all image without associated containers:Things left to do:
Add the documentation for the new commandsRelates to #18601
Fixes #9054.
Closes #22871.
Closes #15331
Depends on #26025(merged)ping @dnephin @tonistiigi @icecrime