forked from jetsonhacks/install-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_nvidia_docker.sh
More file actions
43 lines (29 loc) · 1.09 KB
/
Copy pathinstall_nvidia_docker.sh
File metadata and controls
43 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Script Name: install_nvidia_docker.sh
# Description: Installs NVIDIA Container Toolkit and Docker for GPU-accelerated containerization.
# Exit immediately if a command exits with a non-zero status.
set -e
# Update package lists.
sudo apt update
# Install the NVIDIA Container Toolkit.
sudo apt install -y nvidia-container
sudo apt update
# Download the Docker installation script.
wget https://get.docker.com -O docker_install.sh
# Check if the Docker installation script was downloaded successfully and is not empty.
if [ ! -s docker_install.sh ]; then
echo "ERROR: Docker installation script download failed or file is empty."
rm -f docker_install.sh # Clean up any partial download.
exit 1 # Exit with an error code.
fi
# Make the Docker installation script executable.
chmod +x docker_install.sh
# Install Docker.
sudo ./docker_install.sh
rm docker_install.sh
# Enable and start the Docker service.
sudo systemctl --now enable docker
# Configure NVIDIA Container Toolkit.
sudo nvidia-ctk runtime configure --runtime=docker
echo "NVIDIA Docker installation complete."
exit 0