Search code examples
windowsdockerdocker-desktop

How to install Docker Desktop on a different drive (location) on Windows


I've had Docker Desktop installed on my C:\ drive for a while now and it keeps hogging space on my SSD. Even if I delete all of my containers and images it still takes a lot of space, I'm guessing some cached files or something. The only way I could recover space on my SSD is to fully uninstall Docker Desktop.

I've been trying to install Docker Desktop onto a larger HDD but it's not an option on the installer. I've seen some guides about modifying the services and supplying the --data-root flag but it doesn't seem to work. I couldn't restart the dockerd service, etc.


Solution

    • Don't install using double click on "Docker Desktop Installer.exe".
    • Open Windows Terminal as Administrator (right click on the Terminal icon and click on "Run as Administrator"). Make sure you're using Windows Terminal and not Powershell, as the commands are formatted differently (see the Documentation).
    • Go to the folder where "Docker Desktop Installer.exe" downloaded. Run start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir=E:\path\to\folder Note: the installer does not create the "Docker" dir this way if you don't specify a directory after the driver letter. Make sure to write E:\Docker at minimum

    Note: the WSL, image etc still will be in %HOME%\AppData\Local\Docker. As noted in comments, you can change that too by adding: --wsl-default-data-root=E:\path\to\data\folder
    (for Windows 11, you might also check the another answer in this thread)

    Documentation: https://docs.docker.com/desktop/install/windows-install/#install-from-the-command-line