17.8. Running Podman with less privileges
You can run two nested Podman containers without the --privileged option. Running the container without the --privileged option is a more secure option.
This can be useful when you want to try out different versions of Podman in the most secure way possible.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
Run two nested containers:
$ podman run --name=unprivileged_podman --security-opt label=disable \ --user podman --device /dev/fuse \ registry.access.redhat.com/ubi10/podman \ podman run ubi10 echo hello-
Run the outer container named
unprivileged_podmanbased on theregistry.access.redhat.com/ubi10/podmanimage. -
The
--security-opt label=disableoption disables SELinux separation on the host Podman. SELinux does not allow containerized processes to mount all of the file systems required to run inside a container. -
The
--user podmanoption automatically causes the Podman inside the outer container to run within the user namespace. -
The
--device /dev/fuseoption uses thefuse-overlayfspackage inside the container. This option adds/dev/fuseto the outer container, so that Podman inside the container can use it. -
Run
podman run ubi10 echo hellocommand to create the inner container based on theubi10image. -
Notice that the ubi10 short image name was resolved as an alias. As a result, the
registry.access.redhat.com/ubi10:latestimage is pulled.
Verification
List all containers:
$ podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a47b26290f43 podman run ubi10 e... 30 seconds ago Exited (0) 13 seconds ago unprivileged_podman