Install Docker Wsl 2


This is the quickest way to install Docker on WSL and sync it with your Docker containers.

Wsl -set-version Ubuntu 2. Final step, If you want to use your WSL2 as default version then execute below command. Wsl -set-default-version 2. This completes your WSL2 installation in your Windows 10 PC. For detailed installation guide check this out. Next is to try installing Docker on WSL for which I banged my head like anything in WSL1 world.

  • Install Docker Desktop for Windows top # If you plan to use Docker inside your WSL 2 distro, we suggest to install Docker Desktop by following official documentation. Alternatively, you can decide to skip Docker Desktop and use Docker and NVIDIA Container Toolkit installed directly from your WSL 2.
  • The Docker daemon pulled the 'hello-world' image from the Docker Hub. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.

Configure Docker for Windows

First, we need to expose a port in Docker for Windows for it to work in WSL.

Install Docker

This is how you install Docker in your WSL environment - it is taken from Docker’s installation docs. Just copy and paste basically. This is for Ubuntu 18.04.

After this, close and open a new terminal, so you can run Docker without sudo.

Install Docker Compose

Installing Docker Compose can be done via PIP or the normal apt-get way.

Add bin to your PATH

You need to add /home/<username>/.local/bin to your PATH.

Install Docker Wsl 1 Ubuntu 20.04

Edit your ~/.profile file with nano ~/.profile and add a new line anywhere in the file. Add the text export PATH='$PATH:$HOME/.local/bin'

Run source ~/.profile to activate your new path.


Confirm that it works by running echo $PATH.


Install Docker Wsl2 Without Docker Desktop

You might need to export the following variable to make it work. You can write it either in ~/.zshrc or in ~/.bashrc.

Modify WSL configurations

If you are running Windows 10 18.03+ or newer, it might be good to make some changes. sudo nano /etc/wsl.conf to edit your configurations file.

This will allow you to work from /c instead of /mnt/c, and also fixes some of your permissions. You need to sign out of Windows to make this work.

  • Most Viewed News

    • Node Js Mac Download
    • Itunes Not Opening On Mac
    • Bootable Yosemite
    • Hp Envy 7640 Mac Driver