Skip to content

Instantly share code, notes, and snippets.

@GiovanniGrieco
Last active April 19, 2024 16:26
Show Gist options
  • Save GiovanniGrieco/94ab72099fa35bc307fda0e36b88f1bd to your computer and use it in GitHub Desktop.
Save GiovanniGrieco/94ab72099fa35bc307fda0e36b88f1bd to your computer and use it in GitHub Desktop.
Install Podman on WSL2

Install Podman on Windows Subsystem for Linux 2 (WSL2)

This guide allows a safe and rootless installation of Podman on WSL2. Head over the hyperlinks to discover more about these two wonderful technologies!

This guide assumes that Debian 11 "bullseye" is installed as WSL2 base OS. To do it, simply open your Windows Powershell console under Admin rights and run

PS> wsl install -d Debian

After installation, please check that you are under the latest Debian. If not, please upgrade it.

Now, open a Debian terminal window and execute the following commands:

# sudo apt update
# sudo apt install -y podman

To test out if Podman was installed successfully, execute podman info. Notice an error like the following one:

ERRO[0000] unable to write system event: "write unixgram @00002->/run/systemd/journal/socket: sendmsg: no such file or directory"

To fix it and make sure that Podman works without issues in WSL2, just execute the following commands:

$ mkdir -p $HOME/.config/containers/
$ cp /usr/share/containers/containers.conf $HOME/.config/containers/

Now, please edit $HOME/.config/containers/containers.conf with a text editor and ensure the following lines are set correctly:

cgroup_manager = "cgroupfs"
events_logger = "file"

To test out changes, execute podman info again. The error is now gone! Podman is now ready to be used for rootless containers!

Sources

@b1zzu
Copy link

b1zzu commented May 18, 2022

Awesome, thanks for the short tutorial, it works perfectly

@808codist
Copy link

Thanks - very much appreciated!

Minor correction - this line is missing the filename:

Now, please edit `$HOME/.config/containers/` with a text editor and ensure the following lines are set correctly:

It should be

Now, please edit `$HOME/.config/containers/containers.conf` with a text editor and ensure the following lines are set correctly:

@GiovanniGrieco
Copy link
Author

Thanks - very much appreciated!

Minor correction - this line is missing the filename:

Now, please edit `$HOME/.config/containers/` with a text editor and ensure the following lines are set correctly:

It should be

Now, please edit `$HOME/.config/containers/containers.conf` with a text editor and ensure the following lines are set correctly:

Fixed. Thanks for noticing it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment