Changing storage location for Docker Desktop on Windows

Docker Desktop is an extremely useful way of getting started with Docker, but the Windows client uses WSL and assumes C: has an infinite amount of space. Fortunately it’s not too difficult to change where it stores its stuff.

This Stack Overflow answer goes over the details, reproduced here in case the link rots. The jist is docker uses a WSL machine called docker-desktop-data to store our containers, and we can essentially export that machine’s data, remove the machine, and import it in a new location with the same name.

wsl --export docker-desktop-data "D:\Docker\data.tar"
wsl --unregister docker-desktop-data
wsl --import docker-desktop-data "D:\Docker\data" "D:\Docker\data.tar" --version 2

The WSL distro docker-desktop also exists, but I believe this is the docker desktop app itself and a fixed size (relatively).