26 lines
1.1 KiB
Bash
26 lines
1.1 KiB
Bash
# Run this file as a root user
|
|
#This file install docker and nvidia runtime and create a nvidia-driver conatiner
|
|
|
|
#! /bin/bash
|
|
set -e -x;
|
|
|
|
# update apt-cache and install docker
|
|
apt update && apt install curl -y;
|
|
|
|
#Adding package repository and the GPG key for nvidia conatiner runtime
|
|
distribution=$(. /etc/os-release;echo $ID$VERSION_ID);
|
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg;
|
|
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
|
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
|
|
tee /etc/apt/sources.list.d/nvidia-container-toolkit.list;
|
|
|
|
#Update cache and install nvidia conatiner runtime
|
|
apt-get update && apt install -y nvidia-docker2;
|
|
apt-get update && apt-get install -y nvidia-container-toolkit;
|
|
systemctl restart docker;
|
|
|
|
# create driver conatiner
|
|
docker run --name nvidia-driver -d --privileged --pid=host -v /run/nvidia:/run/nvidia -v /var/log:/var/log --restart=always docker.bitsathy.ac.in/driver ;
|
|
|
|
service docker restart;
|