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

Document how to cleanup images to free disk space #2398

Open
mattfarina opened this issue Jun 15, 2022 · 15 comments
Open

Document how to cleanup images to free disk space #2398

mattfarina opened this issue Jun 15, 2022 · 15 comments

Comments

@mattfarina
Copy link
Contributor

When working with a lot of images it's not uncommon to run into disk space issues in the VM. Document how one can clean this up. There are a few methods including...

  1. Wiping all container images with the click of a button in the settings
  2. Using the UI to bulk delete images
  3. Using the CLI to delete images
@mattfarina
Copy link
Contributor Author

This could be a tutorial

@aminmkhan
Copy link

I think for dockerd (moby) the steps are fairly well documented, for instance in this tutorial.

Rancher Desktop has a Factory Reset option, but this also deletes the Lima VM, but there could be an option in UI to just also remove all existing images and containers.

I think this issue can be closed.

@Enalmada
Copy link

My disk just filled up while I was working on a Dockerfile and generating a ton of build cache without realizing it. Despite going through all the docker cleaning and pruning motions I could find, it didn't help. Turns out rancher-desktop was holding 85 gigs of my disk up with empty space?
image

It would be great if people didn't have to do a Factory Reset to free it.

@fingers10
Copy link

@Enalmada Thanks for the inputs. I was wondering where all the space getting consumed. Now I found it.

@aj-scram
Copy link

aj-scram commented Mar 1, 2024

@Enalmada holy hell I was wondering about this myself

@edrandall
Copy link

edrandall commented Mar 7, 2024

Suffering this same issue rn after a heavy docker build session.
docker images shows only 4 small images, docker container ls -a shows no stopped containers, and yet, within the VM /var/lib/docker/overlay2 is holding on to 88Gb.

Answer seems to be docker system prune which deleted some 80Gb of build cache objects.

Update: docker builder du and docker builder prune are what's required here.

@cwhsu1984
Copy link

Suffering this same issue rn after a heavy docker build session. docker images shows only 4 small images, docker container ls -a shows no stopped containers, and yet, within the VM /var/lib/docker/overlay2 is holding on to 88Gb.

Answer seems to be docker system prune which deleted some 80Gb of build cache objects.

Update: docker builder du and docker builder prune are what's required here.

I'll try this next time. It's insane to get your C disk left with 200MB, and a factory reset to rancher desktop gives you back 50GB...
There should be a one-click function or documentation somewhere that helps user solve this issues.

@edrandall
Copy link

In the UI, look in Extensions and install the Disk Usage extension, this shows the same as docker system df on the cli.
There's also a one-click Reclaim space button

@cmahnke
Copy link

cmahnke commented Aug 7, 2024

@edrandall: This issue seems to be Lima specific: Your proposal doesn't work to /lima/0/diffdisk (on OS X).
The extension you mentioned works on the Docker level, the issue is the volume of the included VM itself...

@edrandall
Copy link

edrandall commented Aug 7, 2024

@cmahnke I'm not sure I understand what you're saying. Please expand/explain what you're seeing.
The title of this issue is "how to cleanup images to free space" and the extension and docker [system|builder|image] prune commands both achieve that. I'm also using OSX.

@cmahnke
Copy link

cmahnke commented Aug 7, 2024

@edrandall: Ok, maybe I have confused the issues / discussions...
#2871

There seem to be a regression.

@gunamata gunamata added this to the 1.16 milestone Aug 7, 2024
@jandubois jandubois modified the milestones: 1.16, 1.17 Aug 30, 2024
@arcaartem
Copy link

Dropping a note here for my future self, in case I forget:

After you run docker [system|builder|image] prune commands, make sure to exit Rancher Desktop completely, because while the images will be cleared from the VM, the actual disk space won't be claimed back until you exit from the app (because the code that actually claims the disk space runs on startup and on exit)

@jandubois
Copy link
Member

@arcaartem You can also run the fstrim command explicitly without exiting Rancher Desktop:

$ rdctl shell sudo fstrim /mnt/data

@cmahnke
Copy link

cmahnke commented Sep 25, 2024

$ rdctl shell sudo fstrim /mnt/data

How about adding this to to the Rancher GUI? Either direct or via a Extension / Plugin?

@jandubois
Copy link
Member

How about adding this to to the Rancher GUI? Either direct or via a Extension / Plugin?

It would be nice if we could automatically run it after you press Reclaim space in the "Disk Usage" extension, but that one comes from Docker and is built for Docker Desktop. Maybe via some kind of Greasemonkey/userscript style code injection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests