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

João Victor @fonteeboa

About: Turning challenges into solutions with secure, innovative, and bug-free digital experiences!

Location:
brazil
Joined:
Jul 31, 2024

🐳📦Installing Docker to a Different Partition on Windows

Publish Date: Aug 4 '24
9 4

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.

Comments 4 total

  • Dipanjan Ghosal
    Dipanjan GhosalAug 5, 2024

    Thanks. Will try this tonight

  • Anorme Inkumsah
    Anorme InkumsahJan 21, 2025

    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!

    • João Victor
      João VictorJan 22, 2025

      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!

      • Anorme Inkumsah
        Anorme InkumsahJan 23, 2025

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

Add comment