BreakingExpress

Get podman up and operating on Windows utilizing Linux

WSL 2, the second iteration of the Windows Subsystem for Linux, lets you run a Linux atmosphere natively on Windows, with out the overhead of a digital machine (VM). It integrates properly with Windows, too, and gives you entry to a lot of the command-line instruments, utilities, and functions you are used to on Linux.

This information exhibits you the way to allow WSL 2 company to run the podman, skopeo, or buildah instructions from inside Windows utilizing the Linux distribution of your selection (obtainable from the Microsoft retailer). Coming from a Fedora Linux host OS start line, I used to be curious the way to allow and use instruments I’m most conversant in from inside Windows.

Prerequisite: WSL 2

To set up WSL 2, go to the WSL installation web page.

Use Powershell to make sure that WSL 2 is enabled by default:

PS> wsl –set-default-version 2

For info on key variations between WSL 1 and WSL 2, see the WSL documentation.

The Windows Subsystem for Linux has come a good distance. Microsoft has labored onerous to make the separation between the host Windows OS and the visitor Linux working system just about invisible. Special drivers within the kernels of every system make it straightforward to run instructions between varied shells and command home windows and allow mutual filesystem entry.

You can affirm you’re accurately utilizing the WSL 2 kernel with the next command and output in any of the company:

$ uname -a
Linux BLD 5.10.16.3-microsoft.standard-WSL2 #1 SMP Fri Apr 2 22:23:49
UTC 2021 x86_64 x86_64 GNU/Linux

WSL 1 company report a kernel model as 4.14 or related.

Small touches in your company could make the mixing much more seamless, together with symlinking of assorted house listing recordsdata (.aws, .sh, .config, and so forth). There is a touch of how this may be achieved proper from the $HOME listing:

Install a Linux distribution

To set up a Linux distribution, discover your favourite within the Microsoft Store.

For this text, I’m utilizing Fedora, however different distributions can be found to attempt. Podman works effectively throughout distributions, so you need to use no matter distribution you are most conversant in. There could also be some minor configuration changes required, however these are usually documented by the distribution and podman documentation. I selected Fedora as a result of it was the distribution that required no further setup to get the most recent podman working.

On the primary launch, the VM and associated applied sciences are put in. You’ll be prompted to pick a password for the primary person (which will get sudo entry).

Install podman

Once your Linux distribution has been put in and configured with a person, you’ll be able to set up podman as normal:

$ sudo dnf set up podman

After a number of moments, podman is put in and able to go. You can verify that all the things is working as anticipated:

$ podman information
host:
  arch: amd64
  buildahVersion: 1.22.3
  cgroupControllers: []
  cgroupManager: cgroupfs
  cgroupVersion: v1
[...]
model:
  APIVersion: 3.3.1
  OsArch: linux/amd64
  Version: 3.3.1

From there, you’ll be able to construct photographs and use podman as you often would.

Thanks to WSL integration, podman is even accessible and usable from PowerShell or the command immediate:

Installing and utilizing the buildah and skopeo instructions is precisely the identical course of.

Busybox check

As a easy check to see podman at work, you’ll be able to pull and run a Busybox container. BusyBox is an open supply (GPL) undertaking offering easy implementations of almost 400 widespread instructions, together with ls, mv, ln, mkdir, extra, ps, gzip, bzip2, tar, and grep, which makes it a fittingly minimal atmosphere for containers and for easy checks like this one.

First, search the default picture repository for a Busybox container. You can do that in both your Linux terminal or in Powershell.

$ podman search busybox
INDEX       NAME                             DESCRIPTION                    
docker.io   docker.io/library/busybox        Busybox base picture                  
docker.io   docker.io/radial/busyboxplus     Full-chain...
docker.io   docker.io/yauritux/busybox-curl  Busybox with CURL

Run the one you need to attempt:

$ podman run -it docker.io/library/busybox
/ #

You can use the container, run a number of instructions to confirm that all the things works as anticipated, then go away it with the exit command.

Get began

I’ll admit I used to be stunned how readily the present Linux distributions on the market, podman, and the Windows subsystem labored collectively right here. It’s apparent a number of nice work has gone into Windows’ container tooling and integration with Linux. I’m hopeful this information helps others get to this identical launching level simply and begin being productive.

There are many good candidates for deep follow-up, together with working with volumes, exposing networked providers between the visitor and the host, and exposing Linux capabilities in these containers. With so many instruments obtainable, I’ve nice confidence that the neighborhood will make brief work of digging by them!

Exit mobile version