Skip to content

Instantly share code, notes, and snippets.

@mac641
Last active April 13, 2024 06:58
Show Gist options
  • Save mac641/07a53ba45f0b30af046d6f9ed94a1ace to your computer and use it in GitHub Desktop.
Save mac641/07a53ba45f0b30af046d6f9ed94a1ace to your computer and use it in GitHub Desktop.
Install Alpine Linux on WSL and connect it to Docker Desktop

Install Alpine Linux on WSL and connect it to Docker Desktop

  • Open an elevated PowerShell prompt.

Set up WSL and install AlpineWSL

  • Enable Windows Subsystem for Linux feature.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  • Reboot your Windows.
  • Make sure WSL has been updated to version 2. If not, you can download the update package here.
  • Set WSL default version to 2:
wsl --set-default-version 2

For all steps above, I've followed this guide by Microsoft.

  • Download AlpineWSL by yuk7 and extract it on your computer. Inside the Alpine folder you'll find a file called Alpine.exe. Execute it to install AlpineWSL.
    • NOTE: I've extracted my Alpine folder to C:\WSL\Alpine.
  • Make Alpine your default Linux distro.
wsl -s Alpine
  • Connect to AlpineWSL.
wsl
  • Install wget.
apk add wget
wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.33-r0/glibc-2.33-r0.apk
apk add glibc-2.33-r0.apk

Install Docker Desktop for Windows

Finalize and test

  • Shut down WSL.
wsl --shutdown
  • Restart Docker daemon.
  • Connect to AlpineWSL again and check for docker/docker-compose.
docker --version
# and/or
docker-compose --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment