
You can install Docker Engine in different ways, depending on your needs:
- Docker Engine comes bundled with . This is the easiest and quickest way to get started.
- Set up and install Docker Engine from .
- and manage upgrades manually.
- Use a . Only recommended for testing and development environments.
Setting up the host machine
Are you on a Windows machine, you can use Docker Desktop or install Docker Engine in WSL 2 (make sure the WSL is version 2).
This article is for you as I will walk you through step by step how to enable your local machine for docker development using wsl 2.
To achieve this we will be using WSL2 (Windows sub-system for Linux) that’s available as a feature in Windows to enable developers to run a Linux environment.
Installing WSL2
You can following this instruction Install WSL and setup ZSH + Oh My ZSH to install WSL or foloowing below steps. You can skip this step if you had WSL2 in your machine.
Open the command prompt and execute the following commands:
Check wsl list
1wsl -l -o # or wsl --list --online
This command is to check list of available Linux distributions available for download through the online store.
Now we install Ubuntu version.
Install Ubuntu
1wsl --install UbuntuVerify installation and check wsl version run this command:
Check wsl version
1wsl -l -v # or you can run wsl --list --verbose
If the version if WSL still version 1 run this command
Set to wsl 2
1wsl --set-default-version 2 wsl --set-version Ubuntu-20.04 2Restart WSL and restart terminal
1wsl --shutdownOpen Bash shell (Ubuntu) Windows start → search for Ubuntu. You will be prompted to set your root username and password in Ubuntu.
Installing docker-engine
Once you are logged in to your Linux distro, Add user as sudo (administrator)
1grep -E 'sudo|wheel' /etc/group
2# Check
3sudo grep -E '%sudo|%wheel' /etc/sudoersYou should see: %sudo ALL=(ALL:ALL) ALL
Update your Ubuntu distro (type Y when asked)
1sudo apt-get update & sudo apt-get upgradeRemove previous docker installation residue, if exist
1sudo apt remove docker docker-engine docker.io containerd runcUpdate apt and install packages to allow apt to use a repository over HTTPS
1sudo apt-get update
2sudo apt-get install ca-certificates curl gnupg lsb-releaseAdd docker official GPG key
1curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpgSet up a stable repository
1echo \
2 "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
3 $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/nullInstall docker-engine using apt
1sudo apt-get update
2sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-pluginAdd the user to the docker group
1sudo groupadd docker
2sudo usermod -aG docker $USERRun docker service
1sudo service docker startCheck status (Must be “docker is running”)
1sudo service docker status