How can I change the location of docker images when using Docker Desktop on WSL2 with Windows 10 Home?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Docker users often face challenges related to storage, especially when dealing with large container images and volumes. If you are using Docker Desktop on WSL2 with Windows 10 Home, you might want to change the default location where Docker stores its images for reasons like space constraints or organizational preferences. This guide will walk you through the process of changing the Docker images location within WSL2.
Understanding the default setup
When you install Docker Desktop on Windows 10 Home and configure it with WSL2, Docker uses a default path within the virtual machine provided by WSL2 to store images and containers. By default, this location can be found within your WSL distribution’s file system, which exists on your primary system drive. If your C: drive gets filled up quickly and you need better control over where Docker stores its images, you might want to change this setup.
Steps to change the location of Docker images
1. Install Docker Desktop and WSL2
Ensure that Docker Desktop is installed on your Windows 10 Home machine and that you have the WSL2 feature enabled. Docker Desktop can be downloaded from the official Docker website.
2. Configure Docker Desktop to use WSL2
Upon installation, configure Docker to use the WSL2 engine, which should provide a better performance compared to the legacy Hyper-V solution on systems like Windows 10 Home.
3. Stop Docker Desktop
Before changing the image storage location, it’s necessary to stop Docker Desktop completely. Exiting the application ensures that no background processes are running that could interfere with moving the Docker data directory.
4. Locate the current Docker data directory
The data directory typically resides inside the primary WSL distribution. You can access this directory from your WSL2 shell (such as Ubuntu) or using the explorer.exe integration feature in WSL:
5. Copy or sync data to the new location
Choose a new location on another drive, say D:, and create a directory for Docker data.
6. Bind mount the new directory
To ensure Docker uses the new path, you need to create a bind mount. Start by editing the wsl.conf file of your Linux distribution environment:
Add or modify these lines to your wsl.conf:
This configuration mount binds your new Docker data directory in place of the default.
7. Restart Docker Desktop
Restart Docker Desktop and verify that it uses the new location for storing images and containers. You can do this by checking Docker settings or by running a container and inspecting the space used in the new directory.
Additional considerations
- Backup: Always backup your Docker data before making major changes to its configuration.
- Permissions: Ensure the new directory has appropriate permissions so that the WSL2 user can access it without issues.
- Performance: Running Docker on a separate physical drive could improve performance by reducing the I/O contention on your system drive.
Summary Table
| Step | Description |
| Install Docker Desktop | Ensure Docker Desktop is installed on Windows 10 with WSL2. |
| Configure WSL2 | Use WSL2 for better integration and performance. |
| Stop Docker | Exit Docker Desktop to prevent process interference. |
| Identify data directory | Locate /var/lib/docker where images are stored. |
| Move data location | Use rsync to copy data to a new directory such as D:\DockerData. |
| Configure bind mount | Edit /etc/wsl.conf to bind mount the new directory for Docker data storage. |
| Restart Docker | Restart Docker Desktop and ensure it functions with the new setup. |
By following these steps, you've successfully reconfigured Docker Desktop on Windows 10 Home to store its images and containers in a custom directory. With this approach, you’ll gain better control over your storage and ensure that Docker's presence doesn’t overcrowd your system drive, providing a smoother and more organized development environment.

