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.
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)
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?
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.
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
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
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.
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.