This article describes how to install NVIDIA-docker on a Linux VM in two parts.
kudos to Bob van Dijk - Amsterdam UMC
Download and ingress the attachment for easy copy/paste.
Part 1: install and start the latest NVIDIA drivers for your GPU card
Open up a terminal on the CentOS VM
Run as root (sudo su)
Install ls hardware which misses in the standard centOS 7.5 image:
yum install lshw
Identify graphic car model and driver:
lshw -numeric -C display Mark the current drive name (let us say it is <drivername>) Now you will have the information needed to find the proper driver for your card when using CentOS on the NVIDIA website (nvidia.com).
Download that driver which comes as an installation file named NVIDIA-Linux-x86-… (more precise: download it to your local machine, upload it to the fileshare, and copy it to a disk on your vm) To install the driver you will need to compile this download and install it in place of the current driver.
Before that there is some preparation necessary on your VM
yum groupinstall “Development Tools”
yum install kernel-devel epel-release
Make a back-up copy of the existing GRUB file (/etc/default/grub)
Edit the GRUB file and set the parameter <drivername>.mode to 0
Remove the current driver file (still as root) by running the following 2 commands:
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
Reboot the VM. When restarted the present driver should not appear if you list the hardware (see above)
Stop the X server (still as root):
systemctl isolate multi-user .target
Install the NVIDIA driver (still as root):
bash NVIDIA-Linux-x86-* probably there will be some questions that you will need to answer. Almost all defaults can be used. However, do not agree to automatically update your driver! (there is no direct internet connection to nvidia.com, so that would generate errors).
If needed you can now run nvidia-settings and configure your GPU card.
Then a final reboot (to restart Xorg and assure everything will work after the next restart.
Part 2 install nvidia-docker packages
Still as root
yum install -y nvidia-docker2
Sync the docker daemon
pkill -SIGHUP dockerd
Remarks:
Having no internet connection from the linux vm makes the process a lot more cumbersome. If there are no data yet, you can ask your agent to open up internet for the workspace temporarily.
I have noticed that the nvidia-docker2 is not in the present yum repository. The workaround: