How to install and access Docker via Ubuntu for Windows Subsystem for Linux (WSL1 and 2)

  1. Install WSL for Windows 10 by following the official guide here. WSL2 is preferred because of reasons listed here. Select Ubuntu 20.04 LTS as the linux distribution of choice.

  2. Download Docker for windows from here. Use instructions from here to use WSL2 backend for Docker. Docker will be accessible via both command prompt and bash.

  3. Use docker hub to make an account, and then login via docker login in bash, and docker logout to logout.

    Some additional points to note -

    • While using docker push [image]to push an image, you may get a denied: requested access to the resource is denied error. Image name should be in the format [username/image]. You may also need to logout and login to Docker again.
    • Windows files can be accessed via WSL using /mnt/[drive letter]/folder. For example F:\Docker can be accessed via /mnt/f/Docker

Hopefully helps some Windows users. WSL2 provides Full Linux Kernel support so should not have compatbility issues as I understand.

3 Likes

MANAGED BY INCF