Docker installation directory

These two parameters control where the Docker Desktop application itself, and the path the wsl2 distributions (that run the docker engine backend) are stored:

--installation-dir=<path> Changes the default installation location (C:\Program Files\Docker\Docker)
--wsl-default-data-root=<path> Changes the default wsl data location

Just pointing the installation dir to another drive isn’t that beneficial, as its size is just a handful of GB, though the wsl default data root that stores the Docker Desktop backend and data can easily grow from two to four digit GB consumption, depending on the usage.

If you want to use Windows Containers as well, you need to set these parameters as well:

--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

Docker Buisness customers can additionaly leverage settings-management to preconfigure Docker Desktop during role out. Though, I haven’t seen it configure the above two parameters.

1 Like

Worked for me. For my installation, I set it up as follows:

  • Main installation D:\Docker
  • WSL: D:\Docker\WSL
  • Windows Containers: D:\Docker\WindowsContainers

Using powershell with Admin privileges, I used the following command:

 Start-Process -Wait -FilePath ".\Docker Desktop Installer.exe" -ArgumentList "install -accept-license --installation-dir=D:\Docker --wsl-default-data-root=D:\Docker\WSL --windows-containers-default-data-root=D:\\Docker\\WindowsContainers"

(Note: the double backslashes are required to specify the Windows container location)

1 Like

thank you so much, I did this and worked, I also did this to move the docker files (not the installation ones) to another disk https://www.youtube.com/watch?v=gWBNk2KYg3M