-
Notifications
You must be signed in to change notification settings - Fork 288
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
Windows 10: Docker does not release disk space after deleting all images and containers #244
Comments
@aludin Thanks for your report. We are already tracking this issue internally and have almost all the pieces in place. Hopefully this feature will be added in one of the next Betas |
@aludin We recently added TRIM support which will reclaim un-used disk space when the application exits. This is currently checked into our master tree and will be available in the next Beta release (hopefully later this week). |
@rneugeba Great! I will test as soon as it is available! |
Beta31 has been release: https://download.docker.com/win/beta/InstallDocker.msi and TRIM support is enabled. I'm closing this issue for now. Please re-open if it is not working as expected. Note, You have to quit the application (or restart) in order to reclaim the disk space. |
I'm re-opening this as we there was a minor bug in Beta31 which prevents the TRIM support to actually be activated. We noticed this too late to merge a fix for Beta32 (released this week) but it should be available in the next Beta (Beat33). Apologies for the delay |
Beta 33 was just released and it contains the fix mentioned above. Please give it a try. |
There has to be a work around right? |
this has now been released both on stable and beta, so no workaround should be necessary. |
Hi |
@citron I'm pretty sure we fixed this on both stable and beta channels. If this issue still persists please open a new issue with a detailed description and a diagnostics ID. Thanks |
@rneugeba Do I really have to reopen the same exact case? It is annoying because I decided to quit Docker on Windows today because of that vhdx-do-not-get-slim thing. I was running the very latest stable Docker on Windows 10 64 bits. |
@citron we enabled "Trim" support in the Linux VM which should reclaim un-used disk space, however Hyper-V will only do most of the reclamation when you shutdown the VM. There is very little online reclamation of un-used disk space in Hyper-V. The VM is shutdown when you quit the Application. Does this reclaim the disk space? And if not, how do you measure it? Windows supports sparse files and the VHDX may say it's of a particualr size but only occupies less on the disk |
@citron hope this helps. |
It appears that virtual disk space tends to expand over time, and even after removing all images and containers, it doesn't automatically shrink. To reduce its size, you need to perform manual optimization. This worked for me after one week of tryingWindows Home version: Windows Pro version: |
The WSL team has added experimental support for sparse virtual disks: microsoft/WSL#4699 (comment) |
Beware, Docker might not work with the latest WSL update, see microsoft/WSL#10487 (comment)
This new feature looks really great but I'll personally wait for the stable WSL release (and people reporting that Docker actually works 😅). |
i had that problem. helped to clear C/USERS/users/AppData/Local/Temp/docker-scout/sha256. it was sized 100 gb for me. it seems to be like a cashed containers or images, but i didn't find fully info about it. |
This worked for me too. Though image data was being stored in C/USERS/users/AppData/Local/Temp/ in multiple folders titled in a "stereoscope-" format. Removed 40 GB being held hostage. I guess one could write a script to remove these files through cmd line. Still waiting for an official fix, periodically going through this process and using the diskpart command mentioned in this thread is unacceptable for long term. |
I created docker/roadmap#578 |
Thank you! I'm literally running out of disk space deleted files inside my volumes but still nothig. |
I don't know if it helps but I found a lot of "docker-tarball files" randomly in the "Temp" folder Path:"C/USERS/users/AppData/Local/Temp" these are probably created by Docker to pass the files of the build context to the daemon. Deleting them saved me up to 200GB . Does it work for you ? |
I have been stumped by this for several days, on a Windows 11 with WSL2 set up w/ Docker and half a dozen images and containers. I kept running out of disk space on Then I tried monitoring the disk writes using process monitor. During building, it was writing to some Then, when the containers were spinning up, I saw it was writing to I don't know what those are for, but even if the folder reported large sizes, the contents within were miniscule. As they were in Temp, I chose to delete them. That saved 25GB - exactly the amount reported but unidentified by Storage Sense and TreeSize! Not even a find on the /C mount from within WSL found that.. We need a way to switch the entirety of storage and operations to some other location, please. This annoyed me like nothing else and made me lose work hours. |
For me, "Docker Desktop" -> "Troubleshoot" -> "Reset to factory defaults" fixed it. |
This comment has been minimized.
This comment has been minimized.
BTW, not sure if this one is turning out to be a distinct issue from what's reported in this ticket, but the files in question here for |
8 years later crazy |
Hello everybody, I found myself in the same situation and none of the commands worked for me
So in the end I had to delete the virtual disk, losing all db data stored in it. Now, how much time will I have before I have to face the same situation again? I don't know, but i would avoid to delete every now and then and re-dump databases. Docker: 4.29.0 compose.yaml i used version: '3.1' |
Hi, i had the same problem! |
Not for me, I tried but nothing changed and all free disk space was saturated, so i had to delete data virtual disk |
Hi @massimo03, @Pygeretmus & @paulwababu, I have been experiencing this same frustrating issue for a long time as well : The WSL 2 ext4.vhdx docker data volume size not being reduced even though I was pruning everything ( But yesterday I managed to shrink this ext4.vhdx WSL data volume from 50 GB to 6.30 GB by following this one-liner command found there: https://dev.to/marzelin/how-to-reduce-size-of-docker-data-volume-in-docker-desktop-for-windows-v2-5d38#comment-1gpen Windows PowerShell command: Just make sure beforehand, to Quit Docker Desktop and that the docker daemon is not running. My environment: Please let me know if that worked as well for you. Have a great day ! |
I thought I had the exact same issue, the .vhdx file was hogging 100+ gb without reason. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Since Docker Desktop 4.34.0: "Windows now supports automatic reclamation of disk space in Docker Desktop for WSL2 installations using a managed virtual hard disk." |
@JocPelletier thanks for highlighting the release note! I'll close this ticket (but if there are further bugs then feel free to open new ones.) |
As of 4.35.1 (my current version) I still face the issue. It is worse than that even. I had a lot of junk piled up after testing and ran out of free disk space again. Since all this junk data was in the Minio's volume i deleted Minio container and proceed to do |
|
Guys just open Powershell This did the work for me Assuming you have Hyper-V installed if not well run this script in Powershell in admin privileges
you would need to run this in Powershell admin privileges to install and enable Hyper-V |
Description
When running docker images using Windows 10 professional, the docker virtual disk MobiLinuxVM.vhdx keeps on growing. After having finished with the images/container, and deleting them all, the virtual disk does not shrink in size. Expected behavior: MobiLinuxVM.vhdx should shrink and release the unused space.
Steps to reproduce the issue:
docker rm $(docker ps -a -q)
anddocker rmi $(docker images -q)
.Describe the results you received:
MobiLinuxVM.vhdx still 40+GB in size
Describe the results you expected:
MobiLinuxVM.vhdx should have "shrunk" to its original size when initially installing Docker on my Windows 10 box.
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):
Windows 10 professional. Docker latest install using Hyper-V.
The text was updated successfully, but these errors were encountered: