💾 Archived View for gmi.runtimeterror.dev › docker-on-windows-10-with-wsl2 › index.gmi captured on 2024-08-18 at 17:34:34. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2024-08-18)
-=-=-=-=-=-=-
2020-09-22
Microsoft's Windows Subsystem for Linux (WSL) 2 was recently updated [1] to bring support for less-bleeding-edge Windows 10 versions (like 1903 and 1909). WSL2 is a big improvement over the first iteration (particularly with better Docker support [2]) so I was really looking forward to getting WSL2 loaded up on my work laptop.
Here's how.
You'll need Windows 10 1903 build 18362 or newer (on x64). You can check by running `ver` from a Command Prompt:
ver Microsoft Windows [Version 10.0.18363.1082]
We're interested in that third set of numbers. 18363 is bigger than 18362 so we're good to go!
You can do this by dropping the following into an elevated Powershell prompt:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Drop this in an elevated Powershell:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
And then reboot (this is still Windows, after all).
Download it from here [3], and double-click the downloaded file to install it.
Open a Powershell window and run:
wsl --set-default-version 2
If you're brand new to this WSL thing, head over to the Microsoft Store [4] and download your favorite Linux distribution. Once it's installed, launch it and you'll be prompted to set up a Linux username and password.
If you've already got a WSL1 distro installed, first run `wsl -l -v` in Powershell to make sure you know the distro name:
wsl -l -v NAME STATE VERSION
And then upgrade the distro to WSL2 with `wsl --set-version <distro_name> 2`:
PS C:\Users\jbowdre> wsl --set-version Debian 2 Conversion in progress, this may take a few minutes...
Cool!
Download Docker Desktop for Windows from here [5], making sure to grab the "Edge" version since it includes support for the backported WSL2 bits.
Run the installer, and make sure to tick the box for installing the WSL2 engine.
Launch Docker Desktop from the Start menu, and you should be presented with this friendly prompt:
Image: Great news! We're supported.
Hit that big friendly "gimme WSL2" button. Then open the Docker Settings from the system tray, and make sure that **General > Use the WSL 2 based engine** is enabled. Now navigate to **Resources > WSL Integration**, confirm that **Enable integration with my default WSL distro** is enabled as well. Smash the "Apply & Restart" button if you've made any changes.
Fire up a WSL session and confirm that everything is working with `docker run hello-world`:
It's beautiful!
---
Automate Packer Builds with GithHub Actions
Self-Hosted Gemini Capsule with gempost and GitHub Actions
Publish Services with Cloudflare Tunnel
---