NVIDIA DRIVER

on archlinux if we want to use NVIDIA-GPUS in container of docker, we should install some NVIDIA packages.

at first we should install nvidia and nvidia-utils, which can be downloaded by:

1
2
3
sudo pacman -S nvidia nvidia-utils
sudo pacman -S nvidia-dkms (to automatic build based on the core type)

when run command of :

1
nvidia-smi;

it will show you the information of GPUS of your computer, it done.

and then we should install nvidia-container-runtime:

1
2
3
4
5
paru -S nvidia-container-runtime

which nvidia-container-runtime


we get the directory of nvidia-container-runtime.

sometimes you should install nvidia-container-toolkit with pacman, determinded by version.

(or with follow command lines)

1
2
sudo pacman -S nvidia-container-toolkit

then we should modify the daemon of docker like this:

1
sudo vim /etc/docker/daemon.json

to add these into the file:

1
2
3
4
5
6
7
8
9
{
"default-runtime": "nvidia",
"runtimes": {
"nvidia": {
"path": "/usr/bin/nvidia-container-runtime",
"runtimeArgs": []
}
}
}

then restart docker:

1
sudo systemctl restart docker

we can comfirm that everything has done like this:

1
2
docker run --rm --runtime=nvidia --gpus all nvidia/cuda:12.2.0-base-ubuntu22.04 nvidia-smi

if you conf correctly, it will show your info of GPUS of your computer.

docker command line homepage

click here to come back to docker command line homepage.