How could I install Docker for Windows on drive E: (my SSD C: is full)?

Hi to everyone reading my post,

I’ve searched on Internet but I couln’d find a correct way to install the main program Docker in another path than C:\ProgramData\Docker.
I don’t have enough space on this drive, then I would to install in E:\ProgramData\Docker.

Is it possible ?
Thanks by advance
David

3 Likes

well, seems to be not possible ?

You can specify the docker data file path by passing in the --data-root in the command line switches to dockerd.exe.

Stop your service:
sc stop docker

Unregister your dockerd service:
dockerd --unregister-service

Then re-register your service with the new data-file path:
dockerd --register-service --data-root e:\ProgramData\docker

Then start your service
sc start docker

help infos:

Note:
previous configured data in c:\ProgramData\Docker is lost when you change the install location.
It’s like a new install to a new location. (images, containers, etc)

2 Likes

thanks a lot, bryoncline :slight_smile:

Hi bryoncline,

I have the same issue, but I didn’t quite get what you do mean?

I haven’t install Docker yet, and all I have is a file. But when I click on it, it starts to download packages without asking the destination. My prompt doesn’t know docker command before I install it. So, what should I do exactly?

Thanks in advance,
M

To fully migrate docker for windows to an external drive, first install it to your main drive. You’ll just have to make some space. WinDirStat is an application that can help create temporary space. Next move the contents of C:\Program Files\Docker to the target location. Then open an administrator command prompt in \Docker\Resources and run

sc stop docker
dockerd --unregister-service
dockerd --register-service --data-root D:\Program Files\Docker(replace with targetlocation)
SC CONFIG com.docker.service binPath= “D:\Program Files\Docker\Docker\com.docker.service”(replace with targetlocation)

Now you should be able to start docker desktop normally.

2 Likes

Same question here. I simply don’t have enough space on my C:\ drive and the default installer seems to be very, very hungry of disk space.

How do I tell the installer to install Docker on another drive ? Thank you.

Thank you @taiiwo. I just changed a little bit based on your solutions, then I finally made it after a few times of trials.

  • 1: Launch Window PowerShell

  • 2: Go to C:\Program Files\Docker\Docker\resources

  • 3: sc.exe stop docker

When I changed sc to sc.exe I showed messages which made me relived. Just typing “sc” may work, but if you make sure docker service stops, I recommend use “sc.exe”
Also, I had a problem while I moved all the files with some files not being moved like com.docker.services showing ‘access denied’ error. So I stopped first then moved files.

  • 4: Go to the destination folder, for example D:\Program Files\Docker\Docker\Resources

  • 5: dockerd --unregister-serivce

If it doesn’t work, type ./dockerd --unregister-service

  • 6: dockered --register-service --data-root D:\ProgramData\Docker

Same as 5, not working, type ./dockerd …

I found it from @bryoncline’s answer above. I prefer @bryoncline’s because I found docker default data-root is C:\ProgramData\Docker. But you may replace this with whatever you want, I guess

  • 7: sc.exe config com.docker.service binPath=“D:\Program Files\Docker\com.docker.service”

I spent a lot of times figuring out errors occurring in this step like

Set-Content : A positional parameter cannot be found that accepts argument
‘binPath=D:\Program\Docker\Docker\com.docker.service’.

If you see this error, just change sc to sc.exe.

Those Commands doesn’t work.

“The specified service does not exist as an installed service.”

you can try

sc.exe stop com.docker.service

you can try sc.exe stop com.docker.service if sc.exe stop docker does not work.

I went a different route and this seems to be working so far:
I uninstalled everything and made the folder structure where I wanted it, then I deleted the folders in C:\ and used these commands.

mklink /j "C:\Users\%USERNAME%\AppData\Local\Docker" "D:\Docker_AppData"
mklink /j "C:\ProgramData\DockerDesktop" "D:\Docker_ProgramData"

obviously replace the D:\ with whatever is working for you… can’t claim credit, found it here:
How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home? - Stack Overflow

6 Likes

Here are the clear instructions on how to do this.

1 Like

I tried this method, but after I completed this and tried to restart docker desktop, a message popped up saying that docker desktop failed to initialize and is shutting down, can you please tell me what I might have done wrong, I did get a configuration successful message on my terminal after executing the last command.

I tried all the previous mentioned ways install docker in other than C drive but didn’t work, this way worked perfectly fine without any errors.

It’s 2022 and still no easy option to change location via installer lol

1 Like

Im use this method, but in my window 10 docker was installed in C:\Program Files\Docker not in C:\ProgramData so i make the link this way

mklink /j "C:\Program Files\Docker" "D:\Docker\Program Files"

1 Like

Hello Friends,

I have used the following command in Windows 11 command prompt to install Docker in D drive.

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

Ref.: Install Docker Desktop on Windows | Docker Docs

Thank you
With Regards
Santhanam

3 Likes

It works.
However, it does not provide full access to the user.

To those having the “denied access” error, launch command prompt as admin