installing GPU nvidia-docker2 on Amzon Linux2

Linux/docker

·

1 min read

  • outline

Installing nvidia-docker2 on CentOS is quite difficult due to dependency and version consistency issues.

  • how-to
sudo yum config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo yum erase podman buildah
sudo yum install docker-ce
sudo systemctl start docker
sudo systemctl enable docker
sudo curl -L https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose version
sudo dnf install -y tar bzip2 make automake gcc gcc-c++ pciutils elfutils-libelf-devel libglvnd-devel
distribution=rhel8
ARCH=$( /bin/arch )
sudo dnf config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/$distribution/${ARCH}/cuda-$distribution.repo
sudo dnf install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
sudo dnf install -y kernel kernel-core kernel-modules
sudo dnf -y module install nvidia-driver:latest-dkms
curl https://nvidia.github.io/nvidia-docker/centos8/nvidia-docker.repo > /etc/yum.repos.d/nvidia-docker.repo
dnf -y install nvidia-container-toolkit
mkdir -p /usr/share/keyrings/
touch /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list
yum -y install http://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-repo-rhel8-10.2.89-1.x86_64.rpm
modprobe -r nouveau
yum -y install cuda
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.repo | >   sudo tee /etc/yum.repos.d/nvidia-docker.repo
yum install nvidia-docker2
reboot
docker run --rm --gpus all nvidia/cuda:11.6.2-base-ubuntu20.04 nvidia-smi
  • reference

https://github.com/docker/compose/releases
nvidia.github.io/nvidia-docker
developer.nvidia.com/blog/streamlining-nvid..
docs.nvidia.com/datacenter/tesla/tesla-inst..
docs.nvidia.com/cuda/cuda-installation-guid..
docs.nvidia.com/datacenter/cloud-native/con..
ibm.com/docs/en/maximo-vi/8.3.0?topic=plann..