2

I want to specify which WSL distros are going to be used to run docker on windows, or at least I want to be able to specify the location in which such distros are located.

I have disks c and d, and Windows is installed on c, which is a SSD with less space. I want to keep the docker engine running on WSL distros stored on d. I could successfully create a WSL Ubuntu 20.04 distro in d by following these instructions.

However, when I install docker on Windows, it creates 2 additional WSL distros:

wsl --list
Ubuntu-20.04 (Default)
docker-desktop-data
docker-desktop

I have no control over how these distros were created. Is there a way to specify their locations or even better, make docker use my Ubuntu-20.04 distro as its backend.

2 Answers 2

1

make docker use my Ubuntu-20.04 distro as its back end

  1. When Docker Desktop restarts, go to Settings > Resources > WSL Integration.
  • WSL Integration will be enabled on your default WSL distribution.

  • To change your default WSL distro, run wsl --set-default <distro name>

    For example, to set Ubuntu as your default WSL distro, run wsl --set-default ubuntu.

  1. Click Apply & Restart.

Source Docker Desktop WSL 2 backend | Docker Documentation

So try running:

wsl --set-default Ubuntu-20.04

in step 8 above.

1

I managed to move the distros by using the tutorial I found here. When docker for windows uses WSL2, it creates 2 distros (docker-desktop-data, docker-desktop). It is possible to move both distros by using the following commads:

wsl --export docker-desktop-data data.tar
wsl --unregister  docker-desktop-data
mkdir docker
wsl --import  docker-desktop-data docker data.tar

wsl --export docker-desktop docker.tar
wsl --unregister   docker-desktop 
mkdir docker-base 
wsl --import   docker-desktop  docker-base  docker.tar

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .