DEV Community

Cover image for 🐳📦Installing Docker to a Different Partition on Windows
João Victor
João Victor

Posted on • Edited on

🐳📦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.

Top comments (1)

Collapse
 
dipanjan profile image
Dipanjan Ghosal

Thanks. Will try this tonight