WindowsmacOS

Where Does Docker Desktop Store Its Data?

Where Docker Desktop keeps its virtual disk on Windows and Mac, and why deleting files inside a container never shrinks that file.

Last updated

Docker Desktop runs its engine inside a small Linux virtual machine, and everything that machine sees, images, containers, volumes and build cache, lives in one virtual disk file on your host. Deleting files inside a container changes what Docker reports and does nothing to the size of that file on disk.

Reclaiming the space takes both halves of the job: prune inside Docker with docker system prune, then compact the disk image with Docker quit and wsl --shutdown first. Skipping the second half is why so many people think Docker swallowed their drive.

Where Docker Desktop stores this, by platform

Windows
%LOCALAPPDATA%\Docker\wsl

The data disk sits under this folder and the exact file varies by version: wsl\data\ext4.vhdx or wsl\data\docker_data.vhdx where the docker-desktop-data distribution exists, and wsl\disk\docker_data.vhdx on Docker Desktop 4.30 and later, which stopped using that distribution. Run wsl --list --verbose to see which you have. The Hyper-V backend keeps its disk at C:\ProgramData\DockerDesktop\vm-data\DockerDesktop.vhdx instead.

macOS
~/Library/Containers/com.docker.docker/Data/vms/0/data/Docker.raw

Older installs used Docker.qcow2 in the same folder. Settings > Resources > Advanced > Disk image location shows the current file, its maximum size and the space it actually uses, and that screen is the supported way to move it. Dragging the file around in Finder leaves Docker pointing at nothing.

Frequently asked questions

why is docker using so much disk space

Everything Docker holds lives in one virtual disk that grows as you add images and build cache, and it never shrinks by itself. Run docker system df to see what is left, prune it, then compact the disk with Docker quit and wsl --shutdown done first.

how do i shrink the docker vhdx file

Quit Docker Desktop, run wsl --shutdown, then compact the file. In an admin PowerShell: Optimize-VHD -Path "$env:LOCALAPPDATA\Docker\wsl\disk\docker_data.vhdx" -Mode Full. On Windows Home, use diskpart with attach vdisk readonly and compact vdisk instead.

i deleted files in a container but disk is still full

Deleting inside a running container only frees space inside the virtual machine. The host file keeps the size it already claimed, so prune first, then compact the vhdx on Windows or Docker.raw on a Mac to give the space back.

Notice an outdated path? Let us know.