When working with Docker on Windows, you might encounter storage limitations on your primary drive (usually C:). Docker stores images, containers, and other data in its default directory, which can quickly consume disk space. Moving these files to another drive is a common solution.
Many users try to use the dockerd
command with the --data-root
parameter, but this often fails because:
- Docker Desktop for Windows doesn't expose the dockerd configuration directly
- The Windows version uses a different architecture than Linux-based Docker
- Recent Docker versions have changed their configuration approach
Here's how to properly move Docker's storage location in Windows 10/11:
1. Stop Docker Desktop
Right-click the Docker icon in the system tray and select "Quit Docker Desktop".
2. Locate Docker Data
Docker typically stores data in:
%USERPROFILE%\AppData\Local\Docker
3. Move the Data
Copy the entire Docker folder to your new location, for example:
robocopy "%USERPROFILE%\AppData\Local\Docker" "E:\DockerData" /MIR
4. Create a Symbolic Link
Create a junction point to redirect Docker to the new location:
mklink /J "%USERPROFILE%\AppData\Local\Docker" "E:\DockerData"
5. Verify the Setup
Restart Docker Desktop and run:
docker info | find "Docker Root Dir"
This should show your new location.
If you're using WSL 2 backend (recommended for Windows):
- Export your WSL distribution:
- Unregister the old distribution:
- Import to new location:
wsl --export docker-desktop "E:\wsl\docker-desktop.tar"
wsl --unregister docker-desktop
wsl --import docker-desktop "E:\wsl\docker-desktop" "E:\wsl\docker-desktop.tar" --version 2
- Ensure Docker Desktop is completely stopped before moving files
- Run commands in an elevated Command Prompt (as Administrator)
- Check disk permissions on the target drive
- For large images, the copy process might take significant time
For frequent moves or team setups, consider this PowerShell script:
# Stop Docker
Stop-Process -Name "Docker Desktop" -Force
# Set paths
$source = "$env:USERPROFILE\AppData\Local\Docker"
$dest = "E:\DockerData"
# Copy files
robocopy $source $dest /MIR
# Create junction
Remove-Item $source -Force
New-Item -ItemType Junction -Path $source -Target $dest
# Restart Docker
Start-Process "$env:ProgramFiles\Docker\Docker\Docker Desktop.exe"
When Docker Desktop is first installed on Windows, it defaults to storing images and containers in the C:\ProgramData\Docker directory. For many developers, especially those with limited SSD space on their system drive, this becomes problematic as Docker images accumulate.
For modern versions of Docker Desktop (2.1.0+), Microsoft provides a built-in way to change the storage location:
1. Right-click the Docker whale icon in the system tray
2. Select "Settings" → "Resources" → "Advanced"
3. Change the "Disk image location" to your desired path (e.g., E:\docker)
4. Click "Apply & Restart"
For older Docker versions or when you need more control, creating a symbolic link is the most reliable approach:
# First, stop Docker completely
Stop-Service docker
Stop-Service com.docker.service
# Move existing Docker data (run as Administrator)
robocopy /MIR C:\ProgramData\Docker E:\DockerData
# Remove original folder and create symbolic link
rmdir /S /Q C:\ProgramData\Docker
mklink /J C:\ProgramData\Docker E:\DockerData
# Restart Docker services
Start-Service docker
Start-Service com.docker.service
After completing either method, verify the new storage location:
docker info | grep "Docker Root Dir"
Or on Windows PowerShell:
(docker info --format "{{.DockerRootDir}}")
For WSL 2 backend users, Docker stores images in a virtual HDD. You can move this file:
1. Export your WSL distribution: wsl --export docker-desktop E:\wsl\docker-desktop.tar
2. Unregister the distribution: wsl --unregister docker-desktop
3. Import to new location: wsl --import docker-desktop E:\wsl\ E:\wsl\docker-desktop.tar --version 2
4. Restart Docker Desktop
Permission problems: Always run commands as Administrator when modifying system directories.
Service won't start: Check Docker logs at %LOCALAPPDATA%\Docker\log\dockerd.log
Get-Content "$env:LOCALAPPDATA\Docker\log\dockerd.log" -Wait
Symbolic link not working: Ensure you used /J
parameter for directory junctions in Windows.
When moving Docker storage to a secondary drive:
- SSD will always outperform HDD for Docker operations
- NTFS is required - don't use FAT32 or exFAT drives
- Network drives are not supported