Search code examples
dockerwindows-subsystem-for-linux

Any reason not to remove Docker as default WSL distro?


I have the latest version of Windows Subsystem for Linux (WSL) installed, but when I run wsl from the command line I get the following error:

An error occurred mounting one of your file systems. Please run ‘dmesg’ for more details.

I hunted down a few possible explanations and one is the possibility that Docker is set as my default wsl. Sure enough, when I run wsl -l -v, the response is:

  NAME                | STATE   | VERSION    
* docker-desktop-data | Stopped | 2    
  docker-desktop      | Stopped | 2  

To correct this, I am told to change the default from Docker to something else with the command wsl -s distroName where “distroName” should be changed to … something.

So I have two questions:

  1. What should I type instead of “distroName”?
  2. Will Docker Desktop still perform as intended if I do this?

Solution

  • If you're not using WSL for anything other than Docker Desktop, then it really doesn't matter.

    But since you attempted to run wsl, it sounds like you may want to try it out. In that case, you should definitely install a WSL distribution that is meant for interactive use.

    The docker-desktop and docker-desktop-data distributions aren't really intended to be accessed directly by the user, but one of them will get set as default if you don't have any other distribution installed. There's a proposal to have a way for Docker to set these as "hidden" so that WSL wouldn't automatically set either as default.

    What should I type instead of “distroName”?

    First, install a user distribution. Which one you choose is up to you, but I typically recommend Ubuntu for first-time installs. When installing WSL on recent Windows releases, it should be the default.

    It's installable via the Microsoft Store -- Just find the one that says "Ubuntu" (with no version number). It will install the latest release.

    Then, in PowerShell;

    wsl --set-default Ubuntu
    

    Will Docker Desktop still perform as intended if I do this?

    Absolutely -- It's really an error/corner-case/oversight that docker-desktop-data ever gets set as default anyway, which is why it's nice that the WSL team is considering a method to prevent this.