Docker have recently announced changes to their pricing and subscriptions which require a paid subscription for users outside of personal, education and small business use.

It seems that this license change only applies to Docker Desktop which is the GUI client for Windows and Mac. The good news is that you can install the Docker Engine on Windows using Windows Subsystem for Linux 2! The bad news is that you won’t have easy access to the GUI to manage containers; you’ll have to use the CLI (although I prefer this anyway).

Install WSL2 (and Ubuntu) 

The first step if you haven’t done it already is to get WSL2 install. I’d recommend setting up WSL2 by following the Microsoft guide to install WSL2 on Windows 10.

I installed the Ubuntu distribution since this is what I am most familiar with.

After WSL2 is setup, you can install Ubuntu by running the following command.

wsl --install -d Ubuntu

Install Docker Engine on WSL2

Now that we have Ubuntu setup on WSL2 we can install the Docker Engine. Docker have a guide for installing Docker Engine on Ubuntu, I would recommend using the repository installation method since this will make installing updates much easier in the future.

After Docker Engine has been installed, I would also recommend following the post-installation steps for Linux. This will allow you to execute Docker commands without requiring to be a root user and ensure that Docker Engine starts on boot.

Steps I followed

For simplicity, I ran the following commands on Ubuntu 20.04 to setup Docker Engine on my machine.

sudo apt-get update
sudo apt-get install \
 apt-transport-https \
 ca-certificates \
 curl \
 gnupg \
 lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
 "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
 $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo service docker start
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

Run Docker Commands

At this point you should have a fully operation Docker Engine installed running on Ubuntu under WSL2. You can check this by trying to run the hello-world image from Docker Hub.

docker run hello-world

After this has completed you should see a message from docker indicating it was successful. If you’re seeing that message, you are ready to go!

One drawback of this approach is that you will need to start the docker service yourself after rebooting or restarting WSL2. You can do this by running the following command.

sudo service docker start

Summary

With the steps above you should have a working copy of Docker Engine running with WSL2! Enjoy!

If your copy isn’t running you might want to check the following things.

  • Ensure your WSL distribution is running on WSL2. You can check by running wsl –l –v.
  • Make sure the docker service is running. You can start the service by running sudo service docker start.

3 Replies to “Install Docker Engine without Docker Desktop on Windows”

  1. Hi James. Thank you for this nicely explained writeup. One thing that I haven’t been able to find any information on is what about .NET Framework application that that to run in a Windows container. Every artifices that I have read only provided a solution for Linux based applications and never mentioned anything about the Windows based applications.

    I asked my Microsoft contact and he said I only need the Docker Engine, and pointed me to your article.

    1. Thanks for your comment!

      The write-up here is focussed on adding support for Linux containers to Windows (these are the only type I typically use).

      Unfortunately, the only way I know to add Windows container support to a desktop version of Windows is to install Docker Desktop.

      You may be able to run Windows Server in a VM and add Windows container support to that, but I haven’t tested this.

      1. Thanks. I tested Windows 2019 Data Center by adding Docker Feature support to it and I was able to build Windows images and run them without Windows Desktop. Based on my research I have to agree that Docker Desktop is the only solution for Windows 10; unless using a VM as you mentioned.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.