Windows 10家庭版能否在WSL中运行Docker Engine?
Absolutely! Running Docker Engine in your WSL Ubuntu environment is not only possible—it’s actually one of the most reliable workarounds for Windows 10 Home users who can’t install Docker Engine directly (without relying on Docker Toolbox). Here’s a step-by-step guide to get it up and running smoothly:
1. Confirm & Upgrade to WSL 2
Docker Engine works best with WSL 2 (WSL 1 has inherent limitations around containerization). First, check your current WSL version:
wsl -l -v
If your Ubuntu instance is running on WSL 1, upgrade it with this command:
wsl --set-version Ubuntu 2
To make WSL 2 the default for any future Linux distros you install, run:
wsl --set-default-version 2
2. Install Docker Engine in WSL Ubuntu
You’ll install the official Docker Engine package just like you would on native Ubuntu:
- First, uninstall any outdated Docker-related packages (if they exist):
sudo apt-get remove docker docker-engine docker.io containerd runc - Set up Docker’s official APT repository:
- Update your system’s package index:
sudo apt-get update - Install required packages to let APT use HTTPS repositories:
sudo apt-get install ca-certificates curl gnupg lsb-release - Add Docker’s GPG key to verify package authenticity:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg - Add the stable Docker repository to your system’s sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Update your system’s package index:
- Install Docker Engine, containerd, and Docker Compose:
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin - Verify the installation was successful by running a test container:
sudo docker run hello-world
If you see a friendly welcome message, Docker is up and running!
3. Optional (But Highly Recommended): Run Docker Without sudo
To avoid typing sudo every time you use Docker commands:
- Create a
dockersystem group:sudo groupadd docker - Add your current user to the
dockergroup:sudo usermod -aG docker $USER - Log out of your WSL session and log back in (or restart WSL), then test the setup without
sudo:docker run hello-world
Quick Tip
You don’t need Docker Desktop for this setup—WSL Ubuntu will run a fully native Docker Engine instance. WSL 2 also offers better file sharing performance with Windows and more reliable networking than WSL 1, making it perfect for Docker workflows.
内容的提问来源于stack exchange,提问作者urig

