Install Docker, Minikube and Kubectl on Ubuntu on WSL
In this story tells the installation steps and challenges when installing Docker, Minikube and Kubectl on Ubuntu 20.04.4 LTS on Widows 10 WSL.
Install Docker in Ubuntu in WSL
Now we are going to install Docker without Docker Desktop in Ubuntu 20.04 in WSL. Please follow each step in below.
sudo apt update
sudo apt install docker.io -y
If you face any issue related to “containerd” when you check the docker version, reinstall containerd and check the docker version again.
sudo apt-get install containerd
docker - version
sudo usermod -aG docker $USER
drop below content into your ~/.profile : It will start docker once you start the ubuntu on WSL.
if grep -q "microsoft" /proc/version > /dev/null 2>&1; then
if service docker status 2>&1 | grep -q "is not running"; then
wsl.exe - distribution "${WSL_DISTRO_NAME}" - user root \
- exec /usr/sbin/service docker start > /dev/null 2>&1
fi
fi
service docker status
docker run hello-world
Following commands are useful when you want to copy files across local host and wsl ubuntu
sudo ls /mnt/*
sudo cp /mnt/c/kafka_2.12–3.3.1.tgz
Install Minikube on Ubuntu in WSL
Let’s run following commands in Ubuntu CLI to install Minikube.
sudo apt install -y curl wget apt-transport-https
wget https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo cp minikube-linux-amd64 /usr/local/bin/minikube
sudo chmod +x /usr/local/bin/minikube
minikube version
If you need kubectl, then run next four commands.
curl -LO https://storage.googleapis.com/kubernetes-release/release/ curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
kubectl version -o yaml
Let’s start minikube now.
minikube start - driver=docker
9. If you find a permission issue, Add your user to the ‘docker’ group using
sudo usermod -aG docker $USER && newgrp docker
Now, everything looks good. We will check the status of the service and open the dashboard.
minikube status
minikube dashboard
That is it. Hope you enjoy the story.
Thank you!