DEV Community

Cover image for šŸ³šŸ“¦Installing Docker to a Different Partition on Windows
JoĆ£o Victor
JoĆ£o Victor

Posted on ā€¢ Edited on

4 1 1 1 1

šŸ³šŸ“¦Installing Docker to a Different Partition on Windows

Welcome to our comprehensive guide on installing Docker in a different partition on Windows! In this post, we'll show you how to overcome the default installation limitations and effectively redirect Docker directories to another drive. By following these steps, you can optimize your system's storage and performance. For more insights and to explore my other repositories or access this post in Portuguese, visit my GitHub profile at my GitHub.


šŸ“‹ Standard Installation

For a standard installation, follow the steps provided in the official Docker documentation, available here. This guide offers detailed instructions for various platforms, including Windows, macOS, and Linux.


šŸ›  Installation in a Different Directory (Windows)

šŸš§ Challenge Faced

In a Windows environment, as of the date of this document, the default Docker configuration does not allow direct selection of the installation directory during the installation process. This necessitated exploring alternatives to bypass this limitation.

Several approaches were investigated to resolve this issue. One involved creating symbolic links using commands like:

mklink /D "C:\ProgramData\Docker" "D:\Docker\ProgramData"
mklink /D "C:\ProgramData\DockerDesktop" "D:\Docker\ProgramDockerDesktop"
mklink /D "C:\Users\User\AppData\Local\Docker" "D:\Docker\AppData"
Enter fullscreen mode Exit fullscreen mode

šŸ’” Solution Found

However, none of these strategies proved effective in redirecting the directories as desired.

The approach that proved efficient was running Docker Desktop through the command prompt (cmd) and adding specific flags during the installation process, as shown in the example below:

start /w "" "Docker Desktop Installer.exe" install --installation-dir=D:\Docker\installation --wsl-default-data-root="D:\Docker\Dados\WSL"
Enter fullscreen mode Exit fullscreen mode

Using this method, it was possible to redirect not only the main installation directory but also other directories associated with Docker to the desired paths.

šŸ“Œ Note

It is important to note that the steps may vary depending on the versions of Docker or the operating system. Therefore, consult the official documentation or support forums for updated information or alternative solutions.

For more details on this issue, you can refer to the related Docker GitHub issue.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (4)

Collapse
 
anorme_inkumsah_fb1644058 profile image
Anorme Inkumsah ā€¢

I honestly had no idea docker was going to take up this much space when I installed it until all of a sudden, my C: drive was in the red zone, this post has been such a lifesaver thanks!

Collapse
 
fonteeboa profile image
JoĆ£o Victor ā€¢

You're welcome! šŸ˜„ Happens to the best of us! A quick tip to avoid this in the future is to periodically run commands like docker system prune to clean up unused data, or consider moving Docker's storage location to another drive with more space. Glad this post helped!

Collapse
 
anorme_inkumsah_fb1644058 profile image
Anorme Inkumsah ā€¢

thanks for the tips :) I'll be sure to implement them in my next project

Collapse
 
dipanjan profile image
Dipanjan Ghosal ā€¢

Thanks. Will try this tonight

šŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay