There does not appear to be any documentation on getting Nvidia support added to Docker or other container run times on Fedora 36, and it appears that Nvidia does not officially support Fedora with libnvidia-container repositories. I looked into this and found a solution to get Nvidia to work with Docker.

Install Docker Community Edition

The first step is to install the community edition of Docker as that is what nvidia-docker2 works with. Luckily Docker does have official support for Fedora, so it is simply running the following to get docker-ce installed.

sudo tee /etc/yum.repos.d/docker-ce.repo <<EOF
name=Docker CE Stable - \$basearch
dnf makecache
dnf install -y docker-ce

Install nvidia-docker2

Now that you have docker-ce installed, the final step is to install the nvidia-docker2 package from Nvidia's RHEL 9 repository.

curl -s -L$DIST/libnvidia-container.repo | \
  sudo tee /etc/yum.repos.d/libnvidia-container.repo
dnf makecache
dnf install -y nvidia-docker2
systemctl restart docker


Now that it is installed, we can test it with the following.

docker run --rm --gpus all nvidia/cuda:11.7.1-runtime-ubuntu22.04 nvidia-smi

Remove nvidia/cuda with the following.

docker rmi nvidia/cuda:11.7.1-runtime-ubuntu22.04

Previous Post Next Post