Question : How to manager WSL
To manage and maintain Windows Subsystem for Linux (WSL), use the
wsl command-line utility in Windows PowerShell or Command Prompt. The core shutdown command is wsl --shutdown, while maintenance tasks use options like --terminate, --export, and --set-version. Shutdown Commands
- Shut down all running distributions and the WSL 2 lightweight utility VM:
wsl --shutdown - Stop a single specific Linux distribution:
wsl --terminate <DistributionName>(orwsl -t <DistributionName>)
Maintenance & Management Commands
- List all installed distributions and check if they are running or stopped:
wsl --list --verbose(orwsl -l -v) - Change a distribution version between WSL 1 and WSL 2:
wsl --set-version <DistributionName> <Version> - Backup or export a distribution to a tar file for maintenance:
wsl --export <DistributionName> <FileName.tar> - Restore or import a distribution from a tar backup file:
wsl --import <DistributionName> <InstallLocation> <FileName.tar> - Completely remove and delete a distribution and its data:
wsl --unregister <DistributionName>
To install Docker Engine on Ubuntu, the recommended approach is to set up Docker's official repository and install the native packages. This ensures you get the latest stable version and security updates.
1. Clear Old Versions
Remove conflicting or older versions before starting:
bash
sudo apt-get remove docker docker-engine docker.io containerd runc
Use code with caution.
2. Set Up the Repository
Install required tools and add Docker's official GPG key to verify packages:
bash
# Update package index
sudo apt-get update
# Install prerequisites
sudo apt-get install ca-certificates curl gnupg -y
# Add the official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to APT sources
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Use code with caution.
3. Install Docker Engine
Update the repository indexes and install Docker alongside Docker Compose:
bash
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y