First, you have to create the files /etc/subgid
and /etc/subuid
, etc by sudo touch /etc/sub{u,g}id
. Afterwards, you can use usermod:
sudo usermod --add-subuids 10000-75535 your_username
sudo usermod --add-subgids 10000-75535 your_username
then
podman system migrate
For using NVIDIA inside podman, the nvidia-container-toolkit must be installed:
sudo eopkg install nvidia-container-toolkit
Now, you have to edit the config file for the nvidia-container-toolkit. It is located at /usr/share/nvidia-container-runtime/config.toml
.
Change the entry #no-cgroups = false
to no-cgroups = true
and the entry
ldconfig = "@/sbin/ldconfig"
to ldconfig = "/sbin/ldconfig"
(solution from here )
Now, the gpu must be useable within a podman container. For testing, e.g. type:
podman run --rm --security-opt=label=disable --hooks-dir=/usr/share/containers/oci/hooks.d/ nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi
It should yield something like this:
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.41.03 Driver Version: 530.41.03 CUDA Version: 12.1 |
|-----------------------------------------+----------------------+----------------------+
This is at least the solution for GPU access inside podman. I have not tested distrobox
yet.