How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home?
See the question and my original answer on StackOverflowIn case this is useful to anyone, after hours trying to change things from the Docker Desktop GUI or settings.json
or deamon.json
, etc to avoid storing the app and the data in C:
, I finally found the only way that fully worked to me is to simply:
- uninstall Docker Desktop
- reinstall it with a command line like this (for example here in my
F:\Docker
folder):
"Docker Desktop Installer.exe" install --accept-license --installation-dir=F:\Docker\bin--wsl-default-data-root=F:\Docker\wsldata --hyper-v-default-data-root=F:\Docker\hvdata
If will work if you choose WSL2 or Hyper-V as the backend (if you switch to Windows container instead of Linux containers this will be needed).
PS: make sure the target folder, (such as F:\Docker
in my case) has needed rights (whatever that means for Docker or its services) otherwise you'll get other cryptic errors like "Unexpected WSL error", etc.