💻 Alpine Linux in WSL

2025-05-18

I'm using a Windows computer for work and like having an instance of Alpine Linux around to do things that are hard on Windows. Or just to have a little bit of fun from time to time.

There are some half-official or non-official version of Alpine for WSL floating around in the Microsoft Store or in some Github repos, but recently I stumbled upon this how-to:

Import file systems into WSL

This made we think that it's probably possible to get Alpine into WSL with just official Alpine pieces. I'll document all the steps here.

First of all, don't use

wsl --install

because this will install some default distribution (probably Ubuntu)!

Instead, we'll follow some manual steps from

First, enable the necessary Windows features from an admin Powershell

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

and reboot the computer. (You can probably remove the /norestart from the second command to get this automatically.)

Then, get the minirootfs of the latest Alpine Edge. My computer has an ARM CPU, so I went to

and grabbed the latest minirootfs, which was alpine-minirootfs-20250108-aarch64.tar.gz at the time of writing this. If you have a more "traditional" AMD or Intel CPU, look in the x86_64 folder instead.

Now, from a regular (i.e., non-admin) cmd or Powershell, import this file system as a new WSL distro:

wsl --import alpine %USERPROFILE%\alpine alpine-minirootfs-20250108-aarch64.tar.gz

If this is your first time using WSL, it tells you about installing and updating things. The messages are confusing in a way that you cannot tell that it's also importing the Alpine file system, but it is.

Now, you can enter your Alpine using

wsl -d alpine

and create a non-root user, add them to the wheel group and set up doas, etc. (I'll spare the details of this here, because it's not specific to the WSL setup).

Once the non-root user is setup, make it the default:

wsl --manage alpine --set-default-user 

That's it. You now have a super minimal Alpine Edge in WSL.

Go back