docker snippets
This post is part of a learning series: Quick Snippets

Installing Docker in a Custom Location on Windows

Posted by Vikash Patel on Saturday, Jan 27, 2024 Reading time: 2 Min

While installing Docker on Windows typically installs it on your C drive, there are scenarios where you might prefer a different location. Perhaps you have limited space on your main drive or want to isolate Docker’s operations for increased performance and security. Whatever the reason, this guide will provide you with the knowledge and steps to install Docker in a custom drive on your Windows system.


  • Windows 10 or later (with Hyper-V and WSL 2 enabled)
  • Docker Desktop installer for Windows
  • Administrator access to your PC
  • A secondary drive with sufficient space (recommended: 64GB+ and preferably an SSD)


  • Download the Docker Desktop installer: Head over to and select the appropriate installer for your Windows version.
  • Create a dedicated folder for Docker on your custom drive: For example, D:\Docker.
  • (Optional) Stop existing Docker daemon (if any): Open Windows PowerShell as administrator and run sc.exe stop docker.


Here is the directory structure:

│   └───docker

Run the installer from command line: Customize the installation location: (e.g., D:\Docker).

Here is the complete command you can run it in administrator Powershell or administrator cmd:

start /w "" "Docker Desktop Installer.exe" install -accept-license \
--installation-dir="D:\Containers\docker\docker" \
--wsl-default-data-root="D:\Containers\wsl" \

Explanation: Here’s the key difference, during installation, add these extra arguments:

  • --wsl-default-data-root="<custom_drive>:\Docker\wsl" - This sets the WSL data directory (for Linux containers) on your custom drive.
  • --windows-containers-default-data-root="<custom_drive>:\Docker\docker" - This tells Docker to store Windows container images and data on your custom drive.

Replace <custom_drive> with your chosen drive letter (e.g., D).

Now restart your computer.

Verify the installation

Open PowerShell again as administrator and run docker version. If everything went well, you’ll see the installed version and other details, confirming Docker’s new home.

That’s all. Now you can store more containers and it will not fill up your system drive.
Happy Coding!

comments powered by Disqus