for-win
for-win copied to clipboard
Disk image location is not changing
- [x] I have tried with the latest version of Docker Desktop
- [x] I have tried disabling enabled experimental features
- [ ] I have uploaded Diagnostics
- Diagnostics ID: n/a, see the diagnostics in this message, below.
Actual behavior
Docker Desktop v4.17.1 Settings -> Resources -> Advanced: Disk image location is set to
C:\Users\username\AppData\Local\Docker\wsl
I press the "Browse" button and select a new location. The text under the "Disk image location" label changes to:
J:\WSL\VM\DockerDesktop\DockerDesktopWSL
I press the "Apply & restart" button and wait. An empty folder named 'DockerDesktopWSL' is created and that's all. Disk image is not in that folder.
I restart the Docker Desktop program. Go to the same settings again and what I see is: the 'Disk image location' is set to the old path before the change !
C:\Users\username\AppData\Local\Docker\wsl
Expected behavior
I expect the disk images to be moved to a new location specified in the settings.
Information
Is it reproducible? I hope so.
Is the problem new? I did not use Docker Desktop before.
Did the problem appear with an update? No.
Windows Version: Microsoft Windows [Version 10.0.19045.2728]
Docker Desktop Version: v4.17.1
WSL2 or Hyper-V backend? WSL2
Are you running inside a virtualized Windows e.g. on a cloud server or a VM: No. Real Windows.
Output of & "C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check
C:\Program Files\Docker\Docker\resources>"C:\Program Files\Docker\Docker\resources\com.docker.diagnose.exe" check [2023-03-28T19:49:31.882953400Z][com.docker.diagnose.exe][I] set path configuration to OnHost Starting diagnostics
[PASS] DD0027: is there available disk space on the host? [PASS] DD0028: is there available VM disk space? [PASS] DD0002: does the bootloader have virtualization enabled? [SKIP] DD0018: does the host support virtualization? [PASS] DD0001: is the application running? [PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled? [PASS] DD0021: is the WSL 2 Windows Feature enabled? [PASS] DD0024: is WSL installed? [PASS] DD0025: are WSL distros installed? [PASS] DD0026: is the WSL LxssManager service running? [FAIL] DD0029: is the WSL 2 Linux filesystem corrupt? [ 4.961706] EXT4-fs error (device sdc): ext4_put_super:1188: comm Xwayland: Couldn't clean up the journal [PASS] DD0035: is the VM time synchronized? [PASS] DD0017: can a VM be started? [PASS] DD0016: is the LinuxKit VM running? [PASS] DD0011: are the LinuxKit services running? [PASS] DD0004: is the Docker engine running? [PASS] DD0015: are the binary symlinks installed? [PASS] DD0031: does the Docker API work? [PASS] DD0013: is the $PATH ok? [PASS] DD0003: is the Docker CLI working? [PASS] DD0005: is the user in the docker-users group? [PASS] DD0038: is the connection to Docker working? [PASS] DD0014: are the backend processes running? [PASS] DD0007: is the backend responding? [PASS] DD0008: is the native API responding? [PASS] DD0009: is the vpnkit API responding? [PASS] DD0010: is the Docker API proxy responding? [PASS] DD0006: is the Docker Desktop Service responding? [SKIP] DD0030: is the image access management authorized? [PASS] DD0033: does the host have Internet access? [PASS] DD0002: does the bootloader have virtualization enabled? [PASS] DD0018: does the host support virtualization? [PASS] DD0001: is the application running? [PASS] DD0022: is the Virtual Machine Platform Windows Feature enabled? [PASS] DD0021: is the WSL 2 Windows Feature enabled? [PASS] DD0024: is WSL installed? [PASS] DD0025: are WSL distros installed? [PASS] DD0026: is the WSL LxssManager service running? [WARN] DD0029: is the WSL 2 Linux filesystem corrupt? [ 4.961706] EXT4-fs error (device sdc): ext4_put_super:1188: comm Xwayland: Couldn't clean up the journal [PASS] DD0035: is the VM time synchronized? [PASS] DD0017: can a VM be started? [PASS] DD0016: is the LinuxKit VM running? [PASS] DD0011: are the LinuxKit services running? [PASS] DD0004: is the Docker engine running? [PASS] DD0015: are the binary symlinks installed? [PASS] DD0031: does the Docker API work? [PASS] DD0032: do Docker networks overlap with host IPs?
Please note the following 1 warning:
1 : The check: is the WSL 2 Linux filesystem corrupt? Produced the following warning: [ 4.961706] EXT4-fs error (device sdc): ext4_put_super:1188: comm Xwayland: Couldn't clean up the journal
If the WSL 2 Linux filesystem is corrupt then Docker Desktop cannot start. There is a known issue fixed in Windows Insider builds which can cause filesystem corruption, see: https://github.com/microsoft/WSL/issues/5895 .
Try running "wsl --shutdown" to stop your WSL Virtual Machine. When it restarts it will run a filesystem check and hopefully fix the problem.
Please investigate the following 1 issue:
1 : The test: is the WSL 2 Linux filesystem corrupt? Failed with: [ 4.961706] EXT4-fs error (device sdc): ext4_put_super:1188: comm Xwayland: Couldn't clean up the journal
If the WSL 2 Linux filesystem is corrupt then Docker Desktop cannot start. There is a known issue fixed in Windows Insider builds which can cause filesystem corruption, see: https://github.com/microsoft/WSL/issues/5895 .
Try running "wsl --shutdown" to stop your WSL Virtual Machine. When it restarts it will run a filesystem check and hopefully fix the problem.
Steps to reproduce the behavior
See above.
I have tried the suggestion of the com.docker.diagnose.exe utility.
I have shut the WSL down, rebooted the PC, but nothing has changed.
wsl --shutdown
The diagnostics is the same.
I mentioned this issue in the WSL issue tracker. https://github.com/microsoft/WSL/issues/5895
I can reproduce this issue.
Eg trying to change the "Disk image location" from SSD to HDD by moving from C: drive to :
B:\user\AppData\Local\Docker\wsl\DockerDesktopWSL
Will just create the folder, and docker desktop will just show the loading icon, with no disk activity on B: drive.
Clicking cancel will show Docker engine is not running
I just ran the docker debug: https://pastebin.com/bdvFK839
i experience the same problem, the loading icon keeps spinning forever and the docker engine is stopped. trying to restart it and the changes are not applied.
from another issue for the mac version. i found a workaround by downgrading the docker desktop version 4.17 stopped the loading phase. but the disk image location reverts back to C: drive
Yesterday I ran into this issue with latest stable Docker Desktop 4.19.0 (106363) and today I ended up with workaround.
UPD1: for 4.20.0
Still does NOT work, but developers have fixed "something" in related issue #13269 So, new issue was created #13522 (wait again until next "fix" π₯)
Temporary solution
Manually change setting customWslDistroDir in %APPDATA%\Docker\settings.json
BUT there are several caveats, please read and repeat carefully π€
How to implement this workaround
Step 0
First of all, after installing Docker Desktop I installed Debian WSL distribution and set it as default distro (before that the default distro was docker-desktop-data).
I don't think this is a critical moment, but Microsoft Learn (former docs) website recommends to install WSL distro before installing Docker Desktop. So, if you need exact PowerShell commands for that:
Install WSL2 Linux distribution and set it as default distro (click to expand)
# I chose 'Debian' but you can install another. Run 'wsl --list --online' to see available distributions
# Somewhere (I don't remember) username and password will be required from you (for the first distro user)
wsl --install Debian
wsl --setdefault Debian
# To see all installed distribution, where * marks default distro
wsl --list --verbose
# Maybe unnecessary step, but it ensures us that default distro will run
wsl ~
# Exit from bash shell (logout)
exit
However, you can try without installing (changing) default WSL distribution. Maybe it will work with docker-desktop-data as default. Then, give us feedback, because I didn't test it π
Step 1
- Quit from Docker Desktop
- Open Docker Desktop setting file
%APPDATA%\Docker\settings.json, e.g. in PowerShell& ($env:APPDATA + "\Docker\settings.json") - Set setting
customWslDistroDir(empty string""by default), for example,"customWslDistroDir": "D:\\apps\\Docker\\docker_wsl_images\\wsl"Pay attention on double backslahes\\in the path. - Save
settings.json - Run Docker Desktop
If you are lucky, one of two ext4.vhdx files (the smallest one) will be moved from old location %LOCALAPPDATA%\Docker\wsl\distro\ext4.vhdx to specified (new) location D:\apps\Docker\docker_wsl_images\wsl\main\ext4.vhdx
Pay attention that sub folder is changed (in my case) from "distro" to "main".
If you are not so lucky (like me), click again...
Docker Desktop may run with custom WSL image path, but "hang up" on stage "Starting the Docker Engineβ¦" or you might see "Unexpected WSL error" message with error "A timeout occurred while waiting for a WSL integration agent to become ready".
In my case, I had to shutdown Docker process manually in Task Manager. Then I did wsl --shutdown and run the default Debian distro wsl ~ before running Docker Desktop.
Step 2
Unfortunately, the largest ext4.vhdx (~1.44GB) file for docker-desktop-data distro stays in its [default] place: %LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx
But you can move it manually. I found a way to do that in this comment.
If you're lazy, I'll provide commands for my paths (click to expand)
wsl --shutdown
wsl --export docker-desktop-data "D:\_cache\2023-05-17_19-41 backup docker-desktop-data distro\docker-desktop-data.tar"
# ATTENTION: The following command deletes .vhdx file (~1.44GB) in '%LOCALAPPDATA%\Docker\wsl\data\ext4.vhdx'
# DO BACK UP BEFORE YOU LOST YOUR DATA π
wsl --unregister docker-desktop-data
wsl --import docker-desktop-data "D:\apps\Docker\docker_wsl_images\wsl\data-distro" "D:\_cache\2023-05-17_19-41 backup docker-desktop-data distro\docker-desktop-data.tar" --version 2
Screenshot of these commands in my PowerShell (click to see the picture)
After moving the image file, Docker Desktop should run normally.
I hope this long long comment will help someone π
My environment (WSL and Docker versions) ...
PS> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
PS> docker --version
Docker version 23.0.5, build bc4487a
yes, such a problem really exists (the recommendations above really helped to solve the problem) I don't quite understand why it is not possible to choose the drive on which docker desktop will be installed during installation.
I don't quite understand why it is not possible to choose the drive on which docker desktop will be installed during installation.
@TheOdemMove Hi! Actually, it's possible π You can't specify where to install Docker's VM (docker-desktop-data and docker-desktop) in installation wizard, BUT you can choose where to install Docker Desktop app (and all its components, ~2.8 GB on Windows). However, you have to install Docker Desktop from the command line in this case. The option --installation-dir will help you π
Docker documentation provides the example without additional command-line arguments. Here's the example for PowerShell to install Docker Desktop to the custom folder:
Start-Process "D:\Docker Desktop Installer.exe" -Wait -ArgumentList "install --installation-dir=D:\apps\Docker\Docker"
Note: Pay attention that there is no any quotes for path value. I didn't try the path with spaces but you can pass a list of strings to -ArgumentList which are not split (as when we pass a single string, my example). See more about ArgumentList
I can reproduce this issue. Eg trying to change the "Disk image location" from SSD to HDD by moving from
C:drive to :B:\user\AppData\Local\Docker\wsl\DockerDesktopWSLWill just create the folder, and docker desktop will just show the loading icon, with no disk activity on
B:drive. Clicking cancel will showDocker engine is not runningI just ran the docker debug: https://pastebin.com/bdvFK839
Same with me
Facing the same issue with hyper-v in the current latest windows docker desktop
try this solution:
- quit docker desktop
- edit
%APPDATA%\Docker\settings.json, change the location to what ever you want - start docker desktop
Same problem on linux debian 12 with docker desktop v4.27.0 when moving Disk image location from an SDD to an HDD. I fix that by editing the dataFolder field in $HOME/.docker/desktop/settings.json. Thanks to these messages for helping me to fix this.
Confirm the same issue occurs with win 11 and latest Docker desktop.
Solution was https://github.com/docker/for-win/issues/13345#issuecomment-1727929905 except the location to change is in "C:\Users[USER]\AppData\Roaming\Docker\settings.json"
Confirm the same issue occurs with win 11 and latest Docker desktop.
Solution was #13345 (comment) except the location to change is in "C:\Users[USER]\AppData\Roaming\Docker\settings.json"
@sonicviz Well, I have no Windows 11, but I don't think they changed a behavior for environment variable APPDATA. It lets you 'hide' your real user name in such public instructions.
Try to paste %APPDATA%\Docker in Windows Explorer's address bar and press Enter (see picture below for Windows 10). If you have not changed the default value it evaluated as C:\Users\yourusername\AppData\Roaming\Docker
Sure, I just prefer seeing complete paths rather than virtual. Either way is fine if it resolves to where you need to get to. The bigger issue is Docker Desktop is still bugged trying to do this in the app. Not a big deal to edit the settings manually, but would be nice if it wasn't bugged as well!
Facing the same issue with hyper-v in the current latest windows docker desktop
try this solution:
- quit docker desktop
- edit
%APPDATA%\Docker\settings.json, change the location to what ever you want- start docker desktop
This is OK, fixed it with this solution, thanks.
@zhqu1148980644 Does not work for me. After changing the path in the file, Docker Desktop 4.34.3 confirms the directory. Puts something into it, but NOT the images. They are still stored somewhere. Notably the images screen also does not help to show them.
Fun fact: if you wanted to user Portainer/Portainer to inspect settings, Docker Desktop again lets you down with 404, access denied. You have read correctly. 404, access denied....
@zhqu1148980644 Does not work for me. After changing the path in the file, Docker Desktop 4.34.3 confirms the directory. Puts something into it, but NOT the images. They are still stored somewhere. Notably the images screen also does not help to show them.
I also had this issue today.
I experience the same problem with version 4.36.
The previously mentioned %APPDATA%\Docker\settings.json does not exist.
Using the previously mentioned docker installation arguments --installation-dir=D:\apps\Docker\Docker changes where docker is installed, but does not change where docker saves its disk images.
The error message I get is: An error occurred while applying the "Disk image location" setting. The previous value has been restored.
status not OK but 500: Unhandled exception: Source and destination directory owner mismatch.
Manually setting the same folder owner on the old and the new directory, does not change anything. Manually moving the DockerDesktop folder to the new location doesn't work, as Docker requires the folder to not already exist.
I experience the same problem with version 4.36.
The previously mentioned
%APPDATA%\Docker\settings.jsondoes not exist.Using the previously mentioned docker installation arguments
--installation-dir=D:\apps\Docker\Dockerchanges where docker is installed, but does not change where docker saves its disk images.The error message I get is: An error occurred while applying the "Disk image location" setting. The previous value has been restored.
status not OK but 500: Unhandled exception: Source and destination directory owner mismatch.
Manually setting the same folder owner on the old and the new directory, does not change anything. Manually moving the DockerDesktop folder to the new location doesn't work, as Docker requires the folder to not already exist.
Same issue, dont find setting json in %APPDATA%\Docker location
My humble advice is to stop trying to use Docker Desktop in its current versions. You waste your time. We can somewhat see the docker location as a comfort function, but Docker Desktop even fails on basics like running containers or stopping them. Running: the containers are "running", but no web request works, logs are empty. Stopping: you see the loop ball forever, containers do not stop.
This kind of issues happened with too many containers to blame the containers, I have never had such issues on Linux.
So the bottom line for me is: very nice looking UI which doesn't allow me to configure essentials, doesn't run containers reliably nor allows primitive controls over them. At the same time, its not like we can see them quickly turning around on issues.
I have the same problem from Win11&hyper-v with the docker-desktop version 4.37.1.
But when I used the administrator to open the docker-desktop, the disk image location change worked well for me.
In the latest version, I'm also having this issue, but what I need to modify is %APPDATA%\Docker\settings-store.json and %APPDATA%\Docker\settings.json
There are a few ways to do it now (apparently) but this is the one that reliably worked for me:
If you want to move WSL2 Linux distro(Ubuntu) from C: drive D: below are the steps.
Install Ubuntu from the MS Store
Run and set up the admin user
Export Ubuntu
β’ mkdir D:\backup
β’ wsl --export Ubuntu D:\backup\ubuntu.tar
Unregister the same distribution to remove it from the C: drive:
β’ wsl --unregister Ubuntu
Import Ubuntu
β’ mkdir D:\wsl
β’ wsl --import Ubuntu D:\wsl\ D:\backup\ubuntu.tar
By default Ubuntu will use root as the default user, to switch back to previous user
Go to the Ubuntu App Folder run command to set default user
β’ cd $env:USERPROFILE\AppData\Local\Microsoft\WindowsApps
β’ ubuntu config --default-user <username>
[Enabling Docker support in WSL 2 distributions](onenote:#Enabling%20Docker%20support%20in%20WSL%202%20distributions§ion-id={18183BC3-12E8-4F33-874A-F61713D00BD7}&page-id={F3B49083-A288-473F-8DAA-49936D82B524}&end&base-path=E:\Documents\OneNote%20Notebooks\Vue%20Quasar%20Development\Docker%20Info\Docker%20WSL.one)
β’ wsl --set-default <distribution name>
From <https://superuser.com/questions/1550622/move-wsl2-file-system-to-another-drive>
I uninstalled docker, reinstalled and then it let me choose D drive for the disk image location
I experience the same problem with version 4.36.
The previously mentioned
%APPDATA%\Docker\settings.jsondoes not exist.Using the previously mentioned docker installation arguments
--installation-dir=D:\apps\Docker\Dockerchanges where docker is installed, but does not change where docker saves its disk images.The error message I get is: An error occurred while applying the "Disk image location" setting. The previous value has been restored.
status not OK but 500: Unhandled exception: Source and destination directory owner mismatch.
Manually setting the same folder owner on the old and the new directory, does not change anything. Manually moving the DockerDesktop folder to the new location doesn't work, as Docker requires the folder to not already exist.
did you fix it? ππ
In the latest version, I'm also having this issue, but what I need to modify is %APPDATA%\Docker\settings-store.json and %APPDATA%\Docker\settings.json
Facing the same issue with hyper-v in the current latest windows docker desktop
try this solution:
- quit docker desktop
- edit
%APPDATA%\Docker\settings.json, change the location to what ever you want- start docker desktop
fix my issue
I don't quite understand why it is not possible to choose the drive on which docker desktop will be installed during installation.
@TheOdemMove Hi! Actually, it's possible π You can't specify where to install Docker's VM (
docker-desktop-dataanddocker-desktop) in installation wizard, BUT you can choose where to install Docker Desktop app (and all its components, ~2.8 GB on Windows). However, you have to install Docker Desktop from the command line in this case. The option--installation-dirwill help you πDocker documentation provides the example without additional command-line arguments. Here's the example for PowerShell to install Docker Desktop to the custom folder:
Start-Process "D:\Docker Desktop Installer.exe" -Wait -ArgumentList "install --installation-dir=D:\apps\Docker\Docker"
Note: Pay attention that there is no any quotes for path value. I didn't try the path with spaces but you can pass a list of strings to
-ArgumentListwhich are not split (as when we pass a single string, my example). See more about ArgumentList
Just a heads-up to anyone coming across this issue in 2025, like I just did. You can still do this via installer flags, they're just a little different now. It now uses specific flags to change the data-root locations.
so, instead of only --installation-dir, you can specify either --hyper-v-default-data-root or --wsl-default-data-root to set the data dir.
something like:
Start-Process "D:\Docker Desktop Installer.exe" -Wait -ArgumentList "install --accept-license --backend=hyper-v --hyper-v-default-data-root=X:\docker-data --installation-dir=X:\apps\Docker "
this should do the trick.
If anyone's curious about the installer flags, here's all of them:
Installs Docker Desktop
"Docker Desktop Installer.exe" install [--quiet] [--accept-license] [--backend=wsl-2 | --backend=hyper-v | --backend=windows] [--allowed-org=<org name>]
--quiet Suppresses information output when running the installer
--accept-license Accepts the Docker Subscription Service Agreement now, rather than requiring it to be accepted when the application is first run
--no-windows-containers Disables Windows containers integration
--allowed-org=<org name> Requires the user to sign in and be part of the specified Docker Hub organization when running the application
--backend=<backend name> Selects the default backend to use for Docker Desktop, hyper-v, windows or wsl-2 (default)
--always-run-service Keep service always running, so regular users can switch to windows containers or hyper-v without being prompted for admin rights
--installation-dir=<path> Changes the default installation location (C:\Program Files\Docker\Docker)
--hyper-v-default-data-root=<path> Changes the default hyper-v VM disk location
--windows-containers-default-data-root=<path> Changes the default windows containers data root
--wsl-default-data-root=<path> Changes the default wsl data location
--admin-settings=<json> Used as admin settings for hardened desktop (needs to use --allowed-org and specify a business tier org)
--proxy-http-mode=<mode> HTTP Proxy mode, system (default) or manual
--override-proxy-http=<URL> URL of the HTTP proxy that must be used for outgoing HTTP requests
--override-proxy-https=<URL> URL of the HTTP proxy that must be used for outgoing HTTPS requests
--override-proxy-exclude=<hosts/domains> Bypass proxy settings for these hosts & domains, comma-separated list
--proxy-enable-kerberosntlm Enables Kerberos/NTLM proxy authentication
For those who got problem with docker desktop: cannot change disk image location. In my case, I uninstalled Docker Desktop. Remember to delete Docker folder in C:\Users{user_name}\AppData\Local\Docker and C:\Users{user_name}\AppData\Roaming\Docker
Then I downloaded Docker Desktop Installer.exe file in Docker Desktop homepage. After downloading. Remember: do not double click on this file to install.
I opened Window Powershell ( Run as Admistration) and run this command for installing Docker:
Start-Process -Wait -FilePath "D:\Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=D:\Applications\Docker\Docker", "--wsl-default-data-root=D:\Applications\Docker\wsl", "--windows-containers-default-data-root=D:\\Applications\\Docker"
where 'D:\Applications\Docker' is a new directory for installing Docker images and files
Finally, It worked
I'm just here to say this is fucking absurd. @minhnhatle104 's suggestion above worked for me. Literally unintalling docker and reinstalling it through powershell so I can tell it where to install to, because the software itself isn't capable of changing the directory it uses. Just ridiculous.
from https://github.com/docker/for-win/issues/13345#issuecomment-2570032088
Windows 10: Start Docker as Admin, then
use UI functionality to move:
Run Docker Desktop as Admin then use Settings/Resource/Disk Image Location to set the new folder fixed it for me