Alpine 3.14 on WSL2
Alpine 3.14 on WSL2
Introduction
There is no official Alpine Linux image for WSL2, let’s do ourself.
Import Alpine Mini RootFS to WSL2
1 2 3
| mkdir alpine-3.14/ curl -LO https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/x86_64/alpine-minirootfs-3.14.2-x86_64.tar.gz wsl --import "Alpine-3.14" alpine-3.14/ alpine-minirootfs-3.14.2-x86_64.tar.gz --version 2
|
Run The Alpine Linux on WSL2
Setup WSL2 Network
1 2 3 4 5 6 7 8 9 10 11
| cat << EOF > /etc/wsl.conf [network] generateResolvConf = false EOF
rm -f /etc/resolv.conf && cat << EOF > /etc/resolv.conf nameserver 114.114.114.114 nameserver 1.1.1.1 nameserver 8.8.8.8 nameserver 9.9.9.9 EOF
|
APK Update
1 2 3 4 5 6
| fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz v3.14.2-40-gf566f645a9 [https://dl-cdn.alpinelinux.org/alpine/v3.14/main] v3.14.2-41-gf6accde870 [https://dl-cdn.alpinelinux.org/alpine/v3.14/community] OK: 14938 distinct packages available
|
1 2
| Linux 5.4.72-microsoft-standard-WSL2 x86_64
|