Reputation: 6060
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.
Upvotes: 63
Views: 55296
Reputation: 177
Download the Docker Desktop exe file.
Open Cmd as a Admin and run the below command.
start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir=D:\docker\Docker --wsl-default-data-root=D:\docker\Docker\images
Upvotes: 0
Reputation: 2294
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 minimumNote: 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
Upvotes: 119
Reputation: 331
With Docker Desktop v4.34.3 you can use the "Settings" menu inside de app to change the data location:
Upvotes: 1
Reputation: 1
In Windows 11, it worked like this:
I had downloaded "Docker Desktop Installer.exe" from Docker website in Downloads folder.
Open PowerShell in Downloads folder by Shift + right click anywhere in empty area then select "Open PowerShell window here".
In PowerShell, copy paste below command and press enter:
Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=D:\Docker\Docker", "--wsl-default-data-root=D:\Docker\wsl", "--windows-containers-default-data-root=D:\\Docker"
After running Docker Desktop, it started running Docker Engine then, I got below error as I already had ubuntu in WSL installed in my system:
WSL integration with distro 'Ubuntu' unexpectedly stopped. Do you want to restart it?
checking distro state for "Ubuntu": Get "http://ipc/check?distro=Ubuntu": context deadline exceeded: unexpected error
Then I ran below 2 commands in Command Prompt to fix the issue.
Note : Try these below commands if you're willing to risk losing the data.
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
Upvotes: 0
Reputation: 21
I tried all of these cmds but none of them works but this one works perfectly in my system :
$dockerPath = "D:\Applications\Docker.exe"
$installArgs = "install --accept-license --installation-dir=""G:\Docker"" --wsl-default-data-root=""G:\WSL"""
Start-Process -FilePath $dockerPath -ArgumentList $installArgs -NoNewWindow -Wait
Upvotes: 0
Reputation: 1
For those who have an error Start-Process : Cannot validate argument on parameter 'ArgumentList'. The argument is null or empty.
, try launch this in cmd:
"Docker Desktop Installer.exe" install -accept-license --installation-dir=D:\Docker --wsl-default-data-root=D:\Docker-data --windows-containers-default-data-root="D:\\Docker-containers"
Don't forget to change the paths to your own.
Upvotes: 0
Reputation: 11
In Windows 11 Follow below steps:
First open Windows Powershell as run as Administrator.
Download Docker Desktop Installer.exe in Your Download folder.
Now in Terminal you are in "C:\Windows\System32" directory.
so please run this command to go Download Directories where we install our Dcoker exe file cd C:\usres{your-username}\Downloads
after that run below command Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=D:\Docker\Docker", "--wsl-default-data-root=D:\Docker\wsl", "--windows-containers-default-data-root=D:\Docker"
Upvotes: 1
Reputation: 11
Start-Process -FilePath "Docker Desktop Installer.exe" -ArgumentList "install -accept-license --installation-dir="D:\Program Files\Docker
" --wsl-default-data-root="D:\Docker\wsl
" --windows-containers-default-data-root="D:\\Docker
"" -Wait
This worked for me, open the powershell where this exe file is located
Upvotes: 1
Reputation: 1
Similar to Mujeeb I got the error message suggesting wsl --shutdown
.
What fixed it for me was creating the specified WSL folder from the original Powershell command.
See https://forums.docker.com/t/docker-installation-directory/32773/24
Upvotes: 0
Reputation: 201
In Windows 11 it worked like this:
Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=D:\Docker\Docker", "--wsl-default-data-root=D:\Docker\wsl", "--windows-containers-default-data-root=D:\\Docker"
Upvotes: 20
Reputation: 381
I've tried many methods as suggested and it did install as expected to different drive than C when using command line. The problem was that it worked with linux containers and images but was still saving Windows images and containers in default C ProgramData although I inserted --windows-containers-default-data-root="D:\Docker"
when installing.
This is what worked for me to install and save images and containers under D drive.
start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir="D:\Docker\Docker" --wsl-default-data-root="D:\Docker\wsl" --windows-containers-default-data-root="D:\\Docker"
Turns out the flag --windows-containers-default-data-root="D:\\Docker"
needed two backslashes instead of one.
Upvotes: 27
Reputation: 1
Windows terminal as administrator - Start-Process -FilePath "G:\APPS\Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=G:\Docker", "--wsl-default-data-root=G:\Docker\images" -Wait
Note: Make sure to create a folder named "Docker" and another folder named "images" inside the Docker folder within your desired volume, in my case it was G:\
Upvotes: 0
Reputation: 59
In my case, this worked well
Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList "install", "-accept-license", "--installation-dir=D:\Docker", "--wsl-default-data-root=D:\Docker\images"
Upvotes: -1
Reputation: 116
Open PowerShell(Run as Administrator).
Navigate to that folder where Docker Desktop Installer.exe is located.( cd folderpath
).
Run this command Start-Process -Wait -FilePath "Docker Desktop Installer.exe" -ArgumentList "install -accept-license --installation-dir=E:\Docker"
Upvotes: 6
Reputation: 51
This Worked For me Using CMD(Admin) "D:\UserName\Downloads\Music\Docker Desktop Installer.exe" install -accept-license --installation-dir="E:\Program Files\Docker"enter image description here
Upvotes: 5
Reputation: 1
2Answer Right u must First
Upvotes: -1
Reputation: 2731
After installation on a different drive on windows 10, you can face an issue with WSL. An error pops up with information related to wsl and recommends running wsl --shutdown
command etc. I tried to fix the error but I couldn't.
The only solution I found was to install it again on the main C:\ drive
but change the image location to a different drive.
Upvotes: 0