Skip to content

Instantly share code, notes, and snippets.

@nikAizuddin
Last active October 21, 2023 21:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nikAizuddin/ccc050816945b2a1b741e4304582b2d0 to your computer and use it in GitHub Desktop.
Save nikAizuddin/ccc050816945b2a1b741e4304582b2d0 to your computer and use it in GitHub Desktop.
Podman Installation on Ubuntu 22.04 WSL2

Podman Installation on Ubuntu 22.04 WSL2

Execute the following command to install Podman:

sudo apt update
sudo apt -y install podman

Execute podman info to initialize rootless Podman:

podman info

Execute the following command to create /etc/containers/containers.conf based on sample config:

sudo cp -v /usr/share/containers/containers.conf /etc/containers/

In /etc/containers/containers.conf file, change the following values (make sure these lines are not commented): 3) Increase ulimits to 65535 and make memlock unlimited:

[containers]
default_ulimits = [ 
  "nofile=65535:65535",
  "memlock=-1:-1"
]

Since ulimit config above only works for rootful Podman, it will cause a permission error when running on rootless Podman. To prevent this error, create an empty default_ulimits in ~/.config/containers/containers.conf file:

[containers]

default_ulimits = []

Allow IPv4 forwarding and ping in /etc/containers/containers.conf:

[containers]
default_sysctls = [
  "net.ipv4.ping_group_range=0 0",
  "net.ipv4.ip_forward=1"
]

In /etc/sysctl.conf, make sure vm.max_map_count is set to at least 300000:

vm.max_map_count=300000

To apply vm.max_map_count without reboot, execute the following command:

sudo sysctl -w vm.max_map_count=300000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment