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)

8 Likes

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

Thanks for this solution. It worked fine for me.

Thanks. This worked for me.

CHAD! ping this comment!

start /w “” “Docker Desktop Installer.exe” install --installation-dir=G:\Docker

works!

In this time and age, not giving users ability to chose installation path is quite primitive if you ask me

Why was this issue closed without any intervention ?

Because that repository is not for feature requests and it was closed by a robot due to inactivity. There is another one, the “Roadmap” for feature requests which is linked in the closed issue. This one:

https://github.com/docker/roadmap/issues/94

And this is not closed. A user there also shared a solution

https://github.com/docker/roadmap/issues/94#issuecomment-2584120387

The same one that was shared in this topic:

You can also find it in the documentation

https://docs.docker.com/desktop/setup/install/windows-install/#installation-behavior

Installation behavior
...
  • --installation-dir=<path>: Changes the default installation location (C:\Program Files\Docker\Docker)

and

Data root and disk location
  • --hyper-v-default-data-root=<path>: Specifies the default location for the Hyper-V VM disk.
  • --windows-containers-default-data-root=<path>: Specifies the default location for the Windows containers.
  • --wsl-default-data-root=<path>: Specifies the default location for the WSL distribution disk.

I assume you would like it to be supportedt when using the GUI. You can add your comments in the Roadmap on GitHub.

Thank you for sharing this.

you can force Docker Desktop to install on a different drive by running the official installer with command-line flags.

  1. Download the Docker Desktop Installer.exe from the official Docker website.
  2. Open Command Prompt (cmd.exe) as an administrator.
  3. Navigate to your downloads folder by running:cd %USERPROFILE%\Downloads
  4. Run the following command to start the silent installation and specify your D: drive as the location:start /wait "" "Docker Desktop Installer.exe" install --quiet --installation-dir="D:\D

Finally a solution after 8 years. Tbh not sure what I was doing 8 years ago.