How to Configure Podman in Rootless Mode?
Question
How to configure Podman in rootless mode?
Environment
Container platform: Podman
Answer
For better security, we recommend that you always run Podman in rootless mode. By default, Podman runs in rootless mode on most systems.
- Using the
xfs
filesystem for/home
($HOME) is highly recommended. - A minimum of 50GB of free disk space for
/home
is recommended.
To configure Podman in rootless mode, do the following:
Ensure that the XDG_RUNTIME_DIR environment variable is set.
export XDG_RUNTIME_DIR=/run/user/$(id -u)
To persist this, you can add it to the
.bashrc
file associated with the user.Run the following commands to start the Podman socket in rootless mode:
systemctl --user enable --now podman.socket systemctl --user start --now podman.socket
Switch to a root user and run the following command to allow services to run even after the user logs out:
sudo loginctl enable-linger <username>