Comment on page

Dependencies

Installing Dependencies: Ubuntu 22.04 or above

  1. 1.
    Install nvidia driver 5.35 (link)
  2. 2.
    Install docker runtime latest (link)
  3. 3.
    Install nvidia-docker latest (link)
  4. 4.
    Install docker-compose latest (link)

1. Install nvidia-driver 5.25.0 (GNOME GUI Nvidia Installation Method)

Open the Software & Updates application window. Select TAB Additional Drivers and choose any proprietary NVIDIA driver. The higher the driver number the latest the version.

2. Install docker-ce runtime

  • Update the apt package index and install packages to allow apt to use a repository over HTTPS
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
  • Add Docker’s official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  • Use the following command to set up the stable repository.
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
  • Update the apt package index, and install the latest version of Docker Engine and containerd, or go to the next step to install a specific version:
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
  • Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world
This command downloads a test image and runs it in a container. When the container runs, it prints an informational message and exits.
  • Post-installation steps for Linux. This allows you to run Docker command without sudo .
    sudo groupadd docker
    sudo usermod -aG docker $USER
  • Log-out from Linux, then log in again. You now can run Docker without sudo.

3. Install nvidia-docker

  • Setup the stable repository and the GPG key
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
  • Install the nvidia-docker2 package (and dependencies) after updating the package listing
sudo apt-get update
sudo apt-get install -y nvidia-docker2
  • Restart the Docker daemon to complete the installation after setting the default runtime
sudo systemctl restart docker
  • At this point, a working setup can be tested by running a base CUDA container (version above 11.6)
sudo docker run --rm --gpus all nvidia/cuda:11.6-base nvidia-smi

4. Install docker-compose

Run this command in Terminal to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose

Installing Dependencies: CentOS7

  1. 1.
    Install nvidia driver > 5.15
  2. 2.
    Install docker runtime (link)
  3. 3.
    Install nvidia-docker (link)
  4. 4.
    Install docker-compose (link)

1. Install nvidia-driver

  • Update yum
sudo yum update
  • Import Elrepo gpg key
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  • Install Elrepo RPM
sudo yum install https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm
  • Install nvidia-driver via nvidia-detect
sudo yum install nvidia-detect
  • Check if the driver is working
nvidia-detect -v
Reboot your computer to ensure the driver is working

2. Install docker-ce

Install the yum-utils package (which provides the yum-config-manager utility) and set up the stable repository.
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
Install the latest version of Docker Engine and containerd.
sudo yum install docker-ce docker-ce-cli containerd.io
Start Docker.
sudo systemctl start docker
Verify that Docker Engine is installed correctly by running the hello-world image.
sudo docker run hello-world

3. Install nvidia-docker

sudo dnf install -y tar bzip2 make automake gcc gcc-c++ vim pciutils elfutils-libelf-devel libglvnd-devel iptables

4. Install docker-compose

First, download the current stable release of Docker Compose (1.24.1.) by running the curl command:
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
The –L option tells the system to follow any redirects, in case the file has been moved. –o changes the filename to docker-compose so you can easily find it when needed. The option /usr/local/bin/ specifies the location in which to store the software package.
Next, change the file permissions to make the software executable:
sudo chmod +x /usr/local/bin/docker-compose