rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.84k stars 272 forks source link

Document how to cleanup images to free disk space #2398

Open mattfarina opened 2 years ago

mattfarina commented 2 years ago

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 commented 2 years ago

This could be a tutorial

aminmkhan commented 2 years ago

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 commented 1 year ago

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 commented 9 months ago

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

aj-scram commented 6 months ago

@Enalmada holy hell I was wondering about this myself

edrandall commented 6 months ago

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 commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

@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 commented 1 month ago

@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 commented 1 month ago

@edrandall: Ok, maybe I have confused the issues / discussions... https://github.com/rancher-sandbox/rancher-desktop/discussions/2871

There seem to be a regression.