Search code examples
windowsdockerdocker-composemakefilewindows-subsystem-for-linux

Docker for Windows installed WSL2 without apt


I'm trying to work on a project, and the setup steps begin like this:

  1. Clone the repo
  2. Set up Docker
  3. Run make

Being a Windows user, I installed Docker for Windows, and it installed WSL2 to get all the Linux stuff set up. But when I went to run make from the WSL shell, it couldn't find it. So I tried to get make from apt-get... and that wasn't there either!

It would appear that my WSL2 install is broken. Unfortunately, Googling for it hasn't turned up much of use. So how do I obtain apt for WSL so that I can build my toolchain?


Solution

  • Something similar happened to me: I installed Docker Desktop in Windows some months ago and it configured WSL to run behind it. However, it was WSL version 1 instead of version 2, and it did not install any Linux distro, since both apps run on top of WSL.

    So please, go through the tutorial on the manual installation of WSL to check if all the steps are actually configured.

    Before that, you can already check what version of WSL you have installed and its state, by running, in CMD or PowerShell:

    wsl -l -v
    

    After you set WSL v2 as your default version (Step 5 of the tutorial), you can make sure that Docker Desktop uses it. For that, check this link on the Docker Desktop WSL 2 backend, more specifically the Install section.


    Regarding the make part of your setup, I believe that you can do that in a system of your preference. If you want to do that on WSL, I recommend you install Ubuntu running over your WSL (Step 6 of the tutorial).

    Once you installed Ubuntu or other distro, you can run it as any other app. There, you can manage your apt, make and other installations right as in Linux :)