Installing Docker Desktop on a non-C drive in Windows
Problem
Docker Desktop defaults to installing on your system drive (C:
), consuming valuable SSD space. Even after removing containers and images, Docker retains significant disk space through:
- WSL distributions and data
- Image caches
- Virtual machine resources
These hidden files prevent SSD space recovery without complete uninstallation if you only installed Docker's executable elsewhere.
Solutions
Use one of these methods to install Docker Desktop and relocate its data storage.
Method 1: GUI Configuration (Docker Desktop v4.34.3+)
- Install Docker Desktop normally (default location)
- Open Docker Desktop settings ➔ Resources ➔ Advanced
- Under "Disk image location," change the path to your desired drive (e.g.,
D:\Docker
) - Click Apply & Restart
WARNING
This method only relocates the disk image, not the entire installation. Executable files remain on C:
.
Method 2: Command-Line Installation (All Versions)
Core Flags
--installation-dir
: Primary executable location--wsl-default-data-root
: Linux container/WSL data--windows-containers-default-data-root
: Windows container data
PowerShell (Admin)
Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList `
"install","-accept-license",
"--installation-dir=D:\Docker\Program",
"--wsl-default-data-root=D:\Docker\WSL",
"--windows-containers-default-data-root=D:\Docker\Containers"
Command Prompt (Admin)
start /w "" "Docker Desktop Installer.exe" install -accept-license ^
--installation-dir="D:\Docker\Program" ^
--wsl-default-data-root="D:\Docker\WSL" ^
--windows-containers-default-data-root="D:\Docker\Containers"
Critical Notes
- Replace
D:
with your target drive - Paths must use double backslashes (
\\
) for Windows containers - Directories should be pre-created:powershell
mkdir D:\Docker mkdir D:\Docker\WSL mkdir D:\Docker\Containers
- Run from the installer's download directory (typically
%USERPROFILE%\Downloads
)
Post-Install Fixes
WSL Integration Errors
If encountering WSL unexpectedly stopped
:
wsl --shutdown
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
WARNING
This deletes existing WSL data. Backup critical containers first!
Space Verification
Confirm relocation success by checking:
- Docker Desktop Settings ➔ Resources ➔ Advanced
- Target drive's folder sizes
Best Practices
- Combine both flags for full relocation:
--installation-dir
+--wsl-default-data-root
- Always pre-create directories to avoid permission issues
- Place installation and data paths on drives with abundant space
- Regularly prune unused resources:powershell
docker system prune --all --volumes --force
Migration Tip
Existing users should uninstall Docker Desktop completely before reinstalling with these commands to avoid configuration conflicts.
Using these methods ensures Docker operates entirely from your secondary drive, freeing primary SSD space without sacrificing functionality.