Run Custom Linux Distro on WSL e.g arch Linux – CLI though
Here is how i accomplished it. In my case, I have Windows 10 on my machine, and I have WSL2 enabled and I have docker desktop installed. These are tools that I use all of the time. I went to docker desktop, checked settings and enabled integration with WSL2, and made sure that my default Ubuntu could use that integration.
Great, so now I can launch my WSL2 based Ubuntu, and I can run docker commands within that Ubuntu instance (without having to actually install docker within that Linux VM…pretty cool, eh?)
Steps: (from within your WSL2 Ubuntu)
docker run -t centos bash ls / (this pulls down CentOS 8 from CentOS and leaves me with a previously running container)
docker ps -a (grab the container ID of the centOS image from the output
docker export containerID# >/mnt/c/temp/centos.tar (put in your containerID# from previous step, this will export CentOS to a .tar file
mkdir C:wslstore (just creating a place on my C drive to store my WSL image…you can name this whatever you like)
mkdir C:wslstoreCentOS (just creating a place in C:wslstore to keep my CentOS image…you can name this whatever you like)
Now, from windows terminal on windows
wsl –import CentOS C:wslstoreCentOS C:tempcentos.tar (this will unpack the tar file and place it in C:wslstoreCentOS and will create a WSL2 image named CentOS)
wsl -d CentOS (this will start up your CentOS WSL image……..Enjoy)
Read more here: Source link