#!/bin/bash
sudo apt install curl
curl https://get.docker.com | sh \
&& sudo systemctl start docker \
&& sudo systemctl enable docker
# Requires nvidia docker - https://github.com/NVIDIA/nvidia-docker
if ! $(apt list --installed | grep -q nvidia-container-toolkit); then
read -p "Nvidia docker is required. Do you want to install it now? (y/n)";
if [ "${REPLY}" == "y" ]; then
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
echo $distribution
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-docker2 # Also installs docker-ce and nvidia-container-toolkit
sudo systemctl restart docker
else
exit 0
fi
fi
标签:sudo,apt,https,nvidia,docker,安装,curl
From: https://www.cnblogs.com/hiccuplh/p/16654948.html