Docker on WSL

Docker is a utility which containerizes applications. To set up docker with the WSL, follow these steps:

  1. Install Docker for Windows.
  2. Check the WSL version of your Ubuntu distro. In the Ubuntu command line,
    wsl.exe -l -v
    
  3. If the version of your Ubuntu distro is 1, you need to upgrade to WSL2. To do this, set the version in Windows Powershell.
    wsl --set-version Ubuntu 2
    
  4. Follow the instructions on the Docker website to add your Ubuntu distro as a Docker resource.
  5. Test the docker installation. In Ubuntu:
    docker run -d -p 80:80 docker/getting-started
    

    And verify the app by accessing the following URL:

    http://localhost
    

    You can also see the app running in the Docker GUI.