Get Started with Docker - Part 2b: Windows 11 Install Guide (WSL and Docker Desktop Edition)
Tags: docker, tutorial, microsoft
Published: 2024-02-29 10:30:00

Running Docker on Windows can be a bit trickier than on Linux but on the flipside can be easier to maintain.

Docker on Windows was mine and many other people’s first step into the Docker ecosystem.

In this guide, we'll install **Docker** onto a Windows 11 machine using **Docker Desktop** and **WSL2 (Windows Subsystem for Linux)**.

We’re going to:

-   Install **WSL (Windows Subsystem for Linux)** and the default **Ubuntu** distribution using **Windows PowerShell**
-   Update **WSL1** to **WSL2** (if on Windows 10)
-   Install **Docker** and all it’s required components like **Docker Compose** using **Docker Desktop** for Windows
-   Download a **Docker Image** and run a test **Docker Container** using the **WSL** Shell

>💡 If you're looking to get this installed on Linux especially the Raspberry Pi then check out our [****"Get Started with Docker - Part 2a : Raspberry Pi Install Guide"****](https://dev.to/reprodev/get-started-with-docker-part-2a-raspberry-pi-linux-install-guide-4hl9)

___

## What’s WSL?

The Windows Subsystem for Linux (WSL) is a full Linux distribution that runs underneath the Windows 10 and 11 operating system. Once installed you can log into a WSL shell using your terminal and send Linux commands like you were using a Linux machine. Machines like a Raspberry Pi.

![Pimp My Windows OS Xzibit Meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zp96l7gs4h9a7l2hbsku.jpg)

The real advantage to this is that you don’t need to use another application like VMWare Workstation to spin up a Linux Virtual Machine. It's also a great way to learn Linux command line. 

You can get more information on WSL in general from the official Microsoft Learn article linked below if you want to learn more.

[Install WSL with Microsoft Learn](https://learn.microsoft.com/en-us/windows/wsl/install)

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExazduZ2w5ZXBuanl0Znd4NWNiNGlqOWU4cWs0NTZkcndzcDR1ajk4ZSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3ov9jDkkI1i8ZEgP7y/giphy.gif">

You can run Docker on Windows without installing WSL by using Hyper-V for Virtualization. However, you’ll get much better performance and compatibility overall if you use the WSL2 backend.

>❓ Please Note: If your machine currently has Hyper-V installed and enabled then be aware this guide will switch off Hyper-V

___

## Install WSL

We’re going to use **Windows PowerShell** to get this installed in just one command

-   Click the **Start Menu** and type **‘powershell**' to find the app in the list
-   Left click **“Run as administrator”** in the right hand menu to open this up as **Administrator**

![WSL Install 01](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5z0sbn8q4e8ta4yrtiqd.png)

-   Click **Yes** on the **User Account Control** notification to continue

![WSL Install 02](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/24zjxikenhtfk1jicbws.png)

-   Click **Yes** on the **User Account Control** notification to open **PowerShell**

![WSL Install 03](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sj5h7qtf00r7oio4ipvx.png)

-   You now have a **Windows PowerShell** command prompt running as an **Administrator**

![WSL Install 04](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fkjhx2zqhact76nt8x7l.png)

-   Type the below command and **Press Enter** to start the install

```
wsl --install
```

![WSL Install 05](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bea4kczk5qvjzeeo1vxq.png)

-   This command will enable a few optional **Windows** features automatically
-   First up, it will install and enable the **Virtual Machine Platform**

![WSL Install 06](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sa2xc8xcv3rj9cjjzldr.png)

![WSL Install 07](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vdphu1asyvb50j9ys5eh.png)

-   Then it will install and enable the **Windows Subsystem for Linux**

![WSL Install 08](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdc042acd7s4rara9t28.png)

-   Finally, it'll install and download the Default Linux distribution provided by **Microsoft** for WSL
-   The Default distribution at time of writing is **Ubuntu 22.04.01 LTS**

![WSL Install 09](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9fu3v4y98ahcmagxc2w.png)

![WSL Install 10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bu7x6wumdpem0ffv1y0.png)

-   **Restart** your machine from the **Start Menu** to complete the install

![WSL Install 11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rpi0hnyvs1bs9lwlfkyg.png)

-   You’ll get a screen saying saying **“Configuring Windows”** or **“Adding Features"**.
-   Once rebooted, go ahead and log back in to **Windows** to continue the installation.
-   Wait a few minutes and a command prompt window will pop up up like below with a title e.g. **Ubuntu**.

![WSL Install 12](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g95puy0tcd1djlplwsr9.png)

-   This will launch **Ubuntu** for the first time.
-   You'll need to set a **Username** and **password** for your WSL installation.

>💡 This can be different from your ****Windows**** ****username**** as they are not connected but there's no issue if they are the same.

-   In this example, we'll set the **UNIX username** as **reprodev**
-   Type your **username** and **Press Enter** to continue

![WSL Install 13](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7743w14paxg910qf3xuu.png)

-   Set a **New password** and **Press Enter**

![WSL Install 14](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67xkx5jtf4jizam5xzq8.png)

-   **Retype** the **New password** to confirm

![WSL Install 15](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x8rdqvxmyy4h5123at6.png)

-   **Press Enter** and as long as the passwords match, then it'll be updated
-   You'll get a message with **"Installation successful!"** to wrap up the **Ubuntu** setup in **WSL**

![WSL Install 16](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/121m6s5cvv8ycgpgbs7y.png)

-   After a minute or so you'll be taken to the **Ubuntu** command line

![WSL Install 17](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7l8ivqdf7xcz2twit40.png)

-   We'll be getting more familiar with this soon but for now type the below command to **exit** and **Press Enter** to close this window

```
exit
```

![WSL Install 18](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rpcurfzkqtuevqr5cobh.png)

---

## Check and Test the WSL Installation

Before we get onto the Docker Desktop installation we need to take a moment to check that WSL and Ubuntu have installed correctly.

-   Open up **Windows PowerShell** again as an **Administrator**

![WSL Install 19](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3k1dh7fs8mgafv4le592.png)

-   Type the below command to confirm that **WSL** has been installed correctly

```
wsl --status
```

![WSL Install 20](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1zs18ohg0xizkdkndj5j.png)

-   You should see the **Default** **Distribution** as **Ubuntu** and the **Default** **Version 2 for WSL**

![WSL Install 21](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xkkz46hrfjfazynxxzyq.png)

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExZ2phejN3MGg2dG9ud21weDVweTY1a2VhM3N3ZTZ0NzFyZzMzdWx4aCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/xT5LMHEcVODxAwrxW8/giphy.gif">

Congratulations, we're halfway there. We’ve installed Linux on Windows using Windows PowerShell on Windows 11.

___

## Update WSL1 to WSL2 (For Windows 10)

The latest version of Windows Subsystem for Linux is WSL2, if you don’t update now you’ll get an error when starting Docker Desktop later on.

>💡 If you're using Windows 11, then you can skip ahead to the next section to install Docker Desktop as you'll have WSL2 set as default. 

>If you're using Windows 10 then you may have to update your WSL version manually.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExMXlhdDlkcXA2eXR3ZDBxaGJ1OGx4c2tndWZsMWNkZDhtZ3NrdDR1ciZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/2dbYSHcl7k5tZCu5Co/giphy.gif">

-   Type the below command and run as an **Administrator** in **Windows PowerShell**
-   **Press Enter** to start the update.

```
wsl --update
```

-   Once completed you'll need to reboot and then you can install **Docker Desktop**

___

## Install Docker on Windows with Docker Desktop

Now that we've installed WSL2 on Windows, we can get started on the Docker part of this installation and get those containers running.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExeWNpb2Jnemxvenpxd3U5bjJ6cXBwMmZ0YWE3YjJjZXVvdGN6engwOCZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/3o6MbjG9edmvKzqzte/giphy.gif">

-   Open a Web Browser, go to [**Docker.com**](https://docker.com) and download the latest **Docker Desktop for Windows**

![Docker Desktop Windows 11 Install 01](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lsx9n8n54v7q3qlar5xw.png)

-   Click the button on the Homepage to start the download of "**Docker Desktop Installer.exe"**

![Docker Desktop Windows 11 Install 02](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3hbrilgipe6d1calu23.png)

![Docker Desktop Windows 11 Install 03](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5karnv53sry174qf9ij.png)

-   Open your Downloads folder and double click the executable once finished downloading.

![Docker Desktop Windows 11 Install 04](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofo6en8ckxe3ny1g5p8a.png)

-   Click **Yes** on the **User Account Control** window to start the install

![Docker Desktop Windows 11 Install 05](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dvhuu6054u5zei9o8t9k.png)

-   This installation of **Docker Desktop** should take about 5 minutes but you may just have time to get a drink.

![Docker Desktop Windows 11 Install 06](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/89cg4fosmyfgvc55djsa.png)

-   Make sure you have "**Use WSL 2 instead of Hyper-V"** and **"Add shortcut to desktop"** ticked in this **Configuration** window
-   Click **Ok** to continue.

![Docker Desktop Windows 11 Install 07](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slx4v8lc75m1gzdgaugq.png)

![Docker Desktop Windows 11 Install 08](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zlxm5u01uj4tazk3kdwx.png)

![Docker Desktop Windows 11 Install 09](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7q1y656z3l44u9h9xny.png)

-   Once the Installation has completed, click the **"Close and restart"** button to reboot Windows.

![Docker Desktop Windows 11 Install 10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q4v0y3fm60l8bmd69a49.png)

-   This **Restart** will take a lot longer than normal as it will be applying all of the features we enabled earlier.
-   If you didn't get a coffee before I'd definitely suggest getting one now as this will take a while

![Docker Desktop Windows 11 Install 11](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/13izsjx271piw6qxdawi.png)

-   Once you've rebooted and logged back in, you'll see a new shortcut on your Desktop for **Docker Desktop**.
-   Double click this to open up **Docker Desktop** for the first time on this machine.

![Docker Desktop Windows 11 Install 12](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x22lb2i58dqhhar1tve1.png)


![Docker Desktop Windows 11 Install 13](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p763hwedvlaa9pd8934o.png)

-   Go ahead and click **Accept** to start up the program after you've read the **Docker Subscription Service Agreement**.

![Docker Desktop Windows 11 Install 14](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fdod5lvjpj01w6sieo8m.png)

-   This will open up **Docker Desktop** for the first time.
-   Untick "Show weekly tips" to stop this window from opening every time you load up the application.

![Docker Desktop Windows 11 Install 15](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/woyvxi483gtpsa35b940.png)

-   You can pick your Role from the dropdown and tick the boxes related to why you are using Docker Desktop. Click **Continue** once you've made your choice.
-   This is just optional so you can just click **Skip**

![Docker Desktop Windows 11 Install 16](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ood26wwr7xkrigh6eiy.png)

-   This will start up the **Docker Engine** for the first time.
-   This first time could take up to 10 minutes to load depending on your hardware and any other applications open at the time
-   You are now at in the **Containers** menu section of **Docker Desktop**

![Docker Desktop Windows 11 Install 17](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifllcmetf3ztk68awkap.png)

-   Right now there is nothing here. Click **Dismiss** in the bottom right to get into the rest of the program
-   This page will normally show any currently running or recently closed **Docker Containers**

![Docker Desktop Windows 11 Install 18](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gizb9bf5szkn0lsx7nz4.png)

-   Click **Images** on the left to see where your Docker Images will be downloaded to

![Docker Desktop Windows 11 Install 19](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crfx5d88vmctb7syqr1z.png)

-   Click **Volumes** on the left to see where your created Docker Volumes will be usually found

![Docker Desktop Windows 11 Install 20](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mkzuykr7cajh9ki25k6a.png)

___

## Testing your Docker Installation - Hello World  

We should now have **WSL 2, Ubuntu** and **Docker Desktop** installed on Windows.

Let's check it's all working by running our first test **Docker container**

-   Open up a **Windows PowerShell** terminal and make sure you **Run as Administrator**

![Docker Desktop Windows 11 Install 21](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ksdt8tizv39u0aajupu.png)

-   Type the below command **wsl** and **Press Enter** to open a WSL shell

```
wsl
```

![Docker Desktop Windows 11 Install 22](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2xa3snk674bp89af1zk.png)

-   This will let you interact with the Ubuntu distro running under WSL

![Docker Desktop Windows 11 Install 23](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a7optazwlq188deaiimv.png)

-   Type the below command and **Press Enter** to check for any running containers

```
docker ps
```

![Docker Desktop Windows 11 Install 24](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ifxfdye94sh7bz8dv2m6.png)

![Docker Desktop Windows 11 Install 25](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9f3wz5smwxi2z699bezw.png)

-   As you can see there are currently no running containers at the moment
-   To test use the below command to run the **Docker Container** for **Hello-World**

```
docker run hello-world
```

![Docker Desktop Windows 11 Install 26](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9yxt99zq27ydc53za3mc.png)

-   The **Docker Image** will be downloaded locally, run the container and output a message in the terminal when successful.

![Docker Desktop Windows 11 Install 27](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1lqp4cvo0cmo6g3k00gk.png)

![Docker Desktop Windows 11 Install 28](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b9n65epgsmex3vgduvcw.png)

-   The **Hello-World** code has been executed and the **Docker Container** has been destroyed.
-   If you open up **Docker Desktop** and now check the **Containers** section you'll see the container we just ran.
-   It will have a random name which may be different to yours but the Image will be **hello-world**

![Docker Desktop Windows 11 Install 29](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/082hs436mbv3sziz6h3d.png)

-   If you open the **Images** section you'll see the **hello-world** image in there now, ready to run without downloading again

![Docker Desktop Windows 11 Install 30](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/144en3sg27eswf37kscp.png)

-   This container didn't create a **Docker Volume** so this section is still empty for now

![Docker Desktop Windows 11 Install 31](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cq7jgwchqqfgfxukf65a.png)

-   Congratulations, you've finally installed Docker on Windows using the WSL 2 backend and even ran a test container.

In our next guide, we’ll set up our first Docker Container on the Raspberry Pi 4 to help block ads and malicious websites on your whole network, Pi-Hole.

<img width="100%" style="width:100%" src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExYzFwMWdhdGk1aHM2OGJtMXhveXB6ZWloN2JjcnNlcmhxaHRpeHdyOSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/l2SqanTUtVa0SW45G/giphy.gif">

---

Next time on Get Started with Docker - Part 3: Pi-Hole

___

Don't forget to explore the rest of our website as we build out more content. Stay tuned for more tutorials, tips, and tricks to help you make tech work for you.

If you want to stay up-to-date with regular updates, make sure to subscribe to our free mailing list.

___