Created
August 19, 2021 07:40
-
-
Save tmbdev/e94fe7f6a98dbfcab164616340f95e81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### DO NOT RUN THIS SCRIPT -- RATHER CUT-AND-PASTE COMMANDS FROM IT ### | |
################################################################ | |
# Basic Docker Install | |
################################################################ | |
# remove old docker installation if any | |
apt-get remove -qqy --purge 'docker-*' | |
apt-get remove -qqy --purge 'docker.*' | |
# prelims | |
apt-get install apt-transport-https ca-certificates curl gnupg lsb-release | |
# add docker key | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ | |
gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg | |
# adding docker repo | |
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list | |
# update | |
apt-get update | |
# install docker | |
apt-get install -qqy docker-ce docker-ce-cli containerd.io | |
# make sure that you are in group "docker" | |
sudo usermod -aG docker `whoami` | |
# log out and back in again to pick up the new group | |
################################################################ | |
# If you also want to use NVIDIA GPUs inside Docker, you need the following as well: | |
################################################################ | |
# add nvidia docker distro | |
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \ | |
&& 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 | |
# update | |
apt-get update | |
# install nvidia-docker2 | |
apt-get install -qqy nvidia-docker2 | |
# restart docker | |
systemctl restart docker | |
# run test container | |
docker run --rm --gpus all nvidia/cuda nvidia-smi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment