Skip to content

Instantly share code, notes, and snippets.

@dinhanhx
Created June 12, 2025 14:47
Show Gist options
  • Select an option

  • Save dinhanhx/3c37e95598fd325d55fdf2c0d4410afc to your computer and use it in GitHub Desktop.

Select an option

Save dinhanhx/3c37e95598fd325d55fdf2c0d4410afc to your computer and use it in GitHub Desktop.
Checking system's nvidia and docker
#!/bin/bash
echo ":) Let's do this!!!"
echo -e "\n#~> Checking the presence of nvidia-smi <~#"
if command -v nvidia-smi &> /dev/null
then
nvidia-smi
else
echo "Nvidia-smi not found. Nvidia driver may not be installed or nvidia-smi may not be in your system's PATH."
fi
echo -e "\n#~> Checking the presence of nvcc <~#"
if command -v nvcc &> /dev/null
then
nvcc --version
else
echo "Nvidia cuda toolkit not found. It may not be installed or not be in your system's PATH."
fi
echo -e "\n#~> Checking the presence of docker <~#"
if command -v docker &> /dev/null
then
docker version
echo -e "\nSome nvidia docker images can be found:"
docker images --format "table {{.Repository}}:{{.Tag}}\t{{.Size}}" | grep "^nvcr.io"
else
echo "Docker command not found. It may not be installed."
fi
echo -e "\n#~> Checking the presence of nvidia-ctk <~#"
if command -v nvidia-ctk &> /dev/null
then
nvidia-ctk --version
else
echo "Nvidia container toolkit not found. It may not be installed."
fi
echo -e "\nNote: If any commands failed, the respective component might not be installed"
echo "or its executable path is not in your system's PATH environment variable."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment