How To Install Docker in WSL Windows 11 & Lando Package & Docker

Follow the below steps to install WSL in Windows 10 or above version

Step [1] – Click on Windows Power Shell

Step [2] – Once Windows Power Shell opened, run below command

wsl --install -d ubuntu

It will run another Windows Power Shell, where asking to create Unix Credentials (Username & Password) and once installed Message will be displayed on Both Window,

as created as

Enter new UNIX username: john1021
New Password: 1234@abcd
Retype new password: 1234@abcd

Step [3] – Once Installed, you can open as below Ubuntu

Finally check version as below command

Step [4] – Installation of Lando Package

Once WSL Installed, need to install lando as below

wget https://files.lando.dev/installer/lando-x64-stable.deb

Once Lando install successfully as below

Step [5] – Once Lando Package has been installed, need to run below command

 sudo dpkg -i lando-x64-stable.deb

After running this command error must be display as below

Error Indicates, Your Windows WSL System ready for Docker Installation

Step [6] – Installation of Docker Package

Step [6.1] – Update the apt package index and install packages to allow apt

sudo apt-get update

Step [6.2] – Install Docker CA Certificate

sudo apt-get install ca-certificates curl gnupg

Optional below in case any error while running command sudo apt-get install ca-certificates curl gnupg

In case any issue / error displaying while running command sudo apt-get install ca-certificates curl gnupg

Follow below command

# Download last stable version  
wget https://files.devwithlando.io/lando-stable.deb
# Show information (Optional)
dpkg --info lando-stable.deb
# Install with Ignore docker
sudo dpkg -i --ignore-depends=docker-ce lando-stable.deb
# Show version
lando -v

Once all Four command done run ca Certificate Command

sudo apt-get install ca-certificates curl gnupg

Step [6.3] – Add Docker’s official GPG key:

sudo install -m 0755 -d /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

sudo chmod a+r /etc/apt/keyrings/docker.gpg

Step [6.4] – Use the following command to set up the repository

echo \
“deb [arch=”$(dpkg –print-architecture)” signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
“$(. /etc/os-release && echo “$VERSION_CODENAME”)” stable” | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Once run above command & error displaying as below

Open File

& remove ” (remobe comma below deb) & save exit by !wq:

Finally run below set of command to install Docker

sudo apt install -y ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update -y
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

Check docker version & verify Docker

If Docker running file, do not need to follow below steps.

Step [6.5] – Installation Docker Engine

Step [6.6] – Update the apt package index by below command

sudo apt-get update

Step [6.7] – Install Docker Engine, containerd, and Docker Compose.

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Step [6.8] – Verify that the Docker Engine installation is successful by running the hello-world image.

sudo docker run hello-world

Step [6.9] – Finally check docker version

Step [6.10] – Verify that the Docker Engine installation is successful by running the hello-world image.

sudo service docker start
sudo docker run hello-world

To Check the status of the Docker Engine service, run this command:

sudo systemctl status docker

Step [6.11] – How To Uninstall Docker

Remove Docker from WSL2 Linux

If Docker was installed directly inside WSL2 Linux, you need to remove it manually.

1. Stop Docker services (inside the WSL2 distro):

sudo systemctl stop docker
sudo systemctl stop docker.socket

2. Remove Docker packages:

You can uninstall Docker by removing its packages using the package manager (apt for Ubuntu/Debian).

sudo apt-get purge docker-ce docker-ce-cli containerd.io

3. Remove Docker directories:

Clean up the directories created by Docker.

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

4. Verify that Docker is completely removed:

Check if Docker is still present in the system.

docker --version

If it returns “Docker not found”, it has been successfully uninstalled.

Finally all set of below command To Uninstall Docker

sudo systemctl stop docker
sudo systemctl stop docker.socket
sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
docker --version
If Docker is no longer installed, this command should return "command not found

Uninstall Lando

1. Uninstall Lando using the package manager:

If you installed Lando using a package manager (like apt or brew), you can use the appropriate command for your platform.

For Ubuntu/Debian (via apt):

sudo apt-get remove --purge lando




2. Remove Lando-related directories:

Lando might create some configuration files and directories, which you can remove manually:

sudo rm -rf ~/.lando
sudo rm -rf /usr/local/bin/lando

3: Verify Lando Removal

Check if Lando has been successfully uninstalled:

lando version

If it’s removed, this will return “command not found.”

Finally all set of below command To Uninstall Lando

sudo apt-get remove –purge lando
sudo rm -rf ~/.lando
sudo rm -rf /usr/local/bin/lando
lando version

If still docker -v still working go to below command

Chances are you still have the snap version of docker installed. Run this:

snap list

And see if docker is listed. If it is, then run

sudo snap remove docker

Now docker should be completely removed, both as snap and deb package.

Step [7] – Once Docker Installed in Windows WSL2

How To Install Magento 2 Windows WSL2 Docker

[a]- git clone https://github.com/markshust/docker-magento.git

run inside /var/www/html/

Once run command 
directory
docker-magento  created

[b]- It will creates folder name docker-magento, /var/www/html/docker-magento

Download composer.json file from

https://github.com/magento/magento2/blob/2.4-develop/composer.json
& keep this file inside
var/www/html/docker-magento/

[c]- Go to Inside compose folder of var/www/html/docker-magento/

[d]- docker-compose up command

It should be always run as per screenshot

[e]-docker-magento is your root directory

[f] – Here download all Magento 2 clone

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition

once clone done -> create docker-compose.yaml file or copy

Finally run

php bin/magento setup:install --base-url="http://127.0.0.1/magento24sample/" --db-host="localhost" --db-name="magesampledata24" --db-user="root" --admin-firstname="admin" --admin-lastname="admin" --admin-email="admin@admin.com" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="INR" --timezone="America/Chicago" --use-rewrites="1" --backend-frontname="admin"

& set values as per requirement

Leave a Reply

Your email address will not be published. Required fields are marked *