<!-- If you are reporting a new issue, make sure that we do not have any duplicates already open. You can ensure this by searching the issue list for this repository. If there is a duplicate, please close your issue and add a comment to the existing issue instead.
If you suspect your issue is a bug, please edit your issue description to include the BUG REPORT INFORMATION shown below. If you fail to provide this information within 7 days, we cannot debug your issue and will close it. We will, however, reopen it if you later provide the information.
For more information about reporting issues, see https://github.com/docker/docker/blob/master/CONTRIBUTING.md#reporting-other-issues
The GitHub issue tracker is for bug reports and feature requests. General support can be found at the following locations:
Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST -->
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)and
docker 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):
Client: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: Wed Oct 26 23:26:11 2016 OS/Arch: windows/amd64 Server: Version: 1.12.3 API version: 1.24 Go version: go1.6.3 Git commit: 6b644ec Built: Wed Oct 26 23:26:11 2016 OS/Arch: linux/amd64
Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 1.12.3 Storage Driver: aufs Root Dir: /var/lib/docker/aufs Backing Filesystem: extfs Dirs: 0 Dirperm1 Supported: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: null host bridge overlay Swarm: inactive Runtimes: runc Default Runtime: runc Security Options: seccomp Kernel Version: 4.4.27-moby Operating System: Alpine Linux v3.4 OSType: linux Architecture: x86_64 CPUs: 2 Total Memory: 1.919 GiB Name: moby ID: IWNC:POO5:TSO4:GIAK:MLHK:C46G:DRJF:IWBM:YSRO:COUL:6TKR:M2ZC Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): true File Descriptors: 12 Goroutines: 22 System Time: 2016-11-20T17:06:20.2301916Z EventsListeners: 0 Registry: https://index.docker.io/v1/ WARNING: No kernel memory limit support Insecure Registries: 127.0.0.0/8
Additional environment details (AWS, VirtualBox, physical, etc.): Windows 10 professional. Docker latest install using Hyper-V.
This works for me to get it to compact. I use zerofree to zero out the unused blocks, which then allows Optimize-VHD to reduce the size of the file. However, the filesystem has to be unmounted for zerofree to work, so I attach the disk to a different VM:
sudo apt install gparted) to shrink the partition containing the Docker data (the partition is likely
/dev/sdb1if you have mounted the disk as described above). Shrink it to a size slightly larger than the amount of data present. Then resize it again to the maximum size available on the virtual disk. This seems to have the effect of moving all the data to the beginning of the partition.
sudo apt install zerofreeand
sudo zerofree /dev/sdb1. This ensures that the empty part of the disk is all zeros.
Optimize-VHD 'C:\Users\Public\Documents\Hyper-V\Virtual hard disks\DockerDesktop.vhdx' -Mode Fullin PowerShell.
C:\Users\Public\Documents\Hyper-V\Virtual hard disks\.