Created
May 22, 2025 14:16
-
-
Save ma-he-sh/96a4ceb93ce7ef48817d8f02847ee93c to your computer and use it in GitHub Desktop.
Install docker and nvidia-container-tookit on Linux Mint 22
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
| #!/bin/bash | |
| set -e # Exit on any error | |
| # Install docker | |
| echo "=== [1/4] Updating APT and Installing Dependencies ===" | |
| # Add Docker's official GPG key: | |
| sudo apt-get update | |
| sudo apt-get install ca-certificates curl | |
| echo "=== [2/4] Installing Docker ===" | |
| sudo install -m 0755 -d /etc/apt/keyrings | |
| sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | |
| sudo chmod a+r /etc/apt/keyrings/docker.asc | |
| # Add the repository to Apt sources: | |
| echo \ | |
| "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | |
| $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ | |
| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
| sudo apt-get update | |
| sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
| sudo usermod -aG docker $USER | |
| # ------ | |
| # https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html | |
| echo "=== [3/4] Installing NVIDIA Container Toolkit ===" | |
| 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/stable/deb/nvidia-container-toolkit.list | \ | |
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ | |
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list | |
| sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list | |
| sudo apt-get update | |
| sudo apt-get install -y nvidia-container-toolkit | |
| echo "=== [4/4] Final Step: Restart Required ===" | |
| echo "You must log out or reboot for group changes and NVIDIA Docker support to take effect." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment