Skip to content

Commit cf49203

Browse files
authored
Add change to install nvidia container toolkit (#309)
1 parent eb4f312 commit cf49203

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

airstack.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,52 @@ function cmd_install {
384384
log_info "Docker installation complete"
385385
fi
386386

387+
# Install NVIDIA Container Toolkit for GPU support
388+
if [ "$OS" = "ubuntu" ] || [ "$OS" = "debian" ]; then
389+
log_info "Installing NVIDIA Container Toolkit..."
390+
391+
# Install prerequisites
392+
log_info "Installing prerequisites for NVIDIA Container Toolkit..."
393+
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
394+
curl \
395+
gnupg2
396+
397+
# Configure the production repository
398+
log_info "Configuring NVIDIA Container Toolkit repository..."
399+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
400+
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
401+
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
402+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null
403+
404+
# Update the packages list from the repository
405+
log_info "Updating package list..."
406+
sudo apt-get update
407+
408+
# Install the NVIDIA Container Toolkit packages
409+
log_info "Installing NVIDIA Container Toolkit packages..."
410+
export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.18.1-1
411+
sudo apt-get install -y \
412+
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
413+
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
414+
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
415+
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
416+
417+
# Configure Docker to use NVIDIA runtime
418+
log_info "Configuring Docker to use NVIDIA runtime..."
419+
sudo nvidia-ctk runtime configure --runtime=docker
420+
421+
# Restart Docker service to apply changes
422+
if systemctl is-active --quiet docker; then
423+
log_info "Restarting Docker service to apply NVIDIA runtime configuration..."
424+
sudo systemctl restart docker
425+
fi
426+
427+
log_info "NVIDIA Container Toolkit installation complete"
428+
else
429+
log_warn "NVIDIA Container Toolkit installation is only supported on Ubuntu/Debian systems"
430+
log_info "For other systems, please install manually: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html"
431+
fi
432+
387433
# Install Docker Compose if needed
388434
if ! command -v docker compose &> /dev/null && [ "$force" = false ]; then
389435
log_info "Installing Docker Compose..."

docs/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ cd AirStack
3131
## Install and Setup
3232

3333
```bash
34-
./airstack.sh install # installs docker and docker-compose
34+
./airstack.sh install # installs docker, docker-compose, and the NVIDIA Container Toolkit
3535
./airstack.sh setup # this lets you use the `airstack` command and sets up your keys
3636
```
3737

0 commit comments

Comments
 (0)