Use Docker without installing Docker desktop

Saisiva
3 min readNov 16, 2022

--

What is Docker??

Docker is an open platform for developing, shipping and running applications. Docker enables us to separate our application from our infrastructure so we can deliver the software quickly. With the advantage of docker methodologies for shipping, testing and deploying code quickly, we can significantly reduce delay between writing code and running in production.

Installing Docker

We can download and install the docker on multiple platforms, as a developer, because of many reasons, I have to use docker on windows. The recommendation was to install docker desktop. With the latest license update the usage of Docker desktop has been restricted not to use in a large enterprise where we need to get a paid subscription. This license update is only for the Docker desktop, but we can use Docker or Docker Engine.

Now we will see how we can enable Docker Engine on windows environment. I tried so many ways to install the Docker and Docker Engine, I will share the way in which I was able to install. Before we install docker we need to have WSL enabled in our windows as a prerequisite.

Enabling WSL2 and Install Ubuntu Linux distribution

  1. Open power shell in administration mode and run the following commands which enables windows features, Windows subsystem for Linux.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

2. When WSL is enabled to need a PC restart which is mandatory.

3. When once restart is done, open PowerShell in administration mode. WSL version has to be set to 2, this can be done with following command.

wsl --set-default-version 2

4. With WSL2 we may need a kernel update which we can download from Kernel Update. Please download x64 version and install.

5. After Kernel update, we can now install ubuntu distribution with following command.

wsl --install --distribution Ubuntu-20.04

with this we have Ubuntu WSL installed in our machine.

Docker Installation

Open the Ubuntu WSL and install the docker with following commands

sudo apt update

//Downloading Dependencies
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

//Adding Docker’s GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

//Installing the Docker Repository
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

sudo apt update

//To verify the Docker version
docker --version

//To install the docker compose
sudo apt-get install docker-compose

with this we can now use docker and docker compose for our development and testing purpose.

Issues we might face

  1. If we are not able to update the packages in ubuntu from internet we should add the nameserver to resolve conf with following command.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null

2. Even after the docker installation if we are facing issue in starting docker service, we should run the following command.

sudo apt install docker-ce docker-ce-cli containerd.io

With these steps I was able to enable WSL and use docker in my windows. Hope this helps you in installing and using Docker.

Thanks for reading, Follow me for more

--

--