Optimize VMware vSphere for AI and Data Science Workloads
Optimize VMware vSphere for AI and Data Science Workloads (Latest Version)

Step #3: Installing Docker and Docker Utility Engine for NVIDIA GPUs

The NVIDIA Container Toolkit allows users to build and run GPU accelerated Docker containers. The toolkit includes a container runtime library and utilities to configure containers to leverage NVIDIA GPUs automatically. Complete documentation and frequently asked questions are available on the repository wiki.

dg-docker-01.png

First you will need to set up the repository.

Important

You will need VM Console located on the left navigation pane. DO NOT USE the vCenter web console!

Important

When connecting to the VM Console use the log in credentials created for the VM in Step #2 Create Your First NVIDIA AI Enterprise VM.

Update the apt package index with the command below:

Copy
Copied!
            

$ sudo apt-get update

Install packages to allow apt to use a repository over HTTPS:

Copy
Copied!
            

$ sudo apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ gnupg-agent \ software-properties-common

Next you will need to add Docker’s official GPG key with the command below:

Copy
Copied!
            

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88, by searching for the last 8 characters of the fingerprint:

Copy
Copied!
            

$ sudo apt-key fingerprint 0EBFCD88 pub rsa4096 2017-02-22 [SCEA] 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 uid [ unknown] Docker Release (CE deb) <docker@docker.com> sub rsa4096 2017-02-22 [S]

Use the following command to set up the stable repository:

Copy
Copied!
            

$ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs)\ stable"

Install Docker Engine

Copy
Copied!
            

$ sudo apt-get update

Copy
Copied!
            

$ sudo apt-get install -y docker-ce docker-ce-cli containerd.io

Verify that Docker Engine - Community is installed correctly by running the hello-world image:

Copy
Copied!
            

$ sudo docker run hello-world

More information on how to install Docker can be found here.

Make sure you have installed the NVIDIA driver and Docker 20.10 for your Linux distribution.

Note

You do not need to install the CUDA toolkit on the host, but the driver needs to be installed.

Note

With the release of Docker 19.03, usage of nvidia-docker2 packages is deprecated since NVIDIA GPUs are now natively supported as devices in the Docker runtime.

For first-time users of Docker 20.10 and GPUs, continue with the instructions for getting started below.

  1. Add the package repositories:

    Copy
    Copied!
                

    $ 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


  2. Download information from all configured sources about the latest versions of the packages and install the nvidia-container-toolkit package:

    Copy
    Copied!
                

    $ sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit


  3. Restart the Docker service:

    Copy
    Copied!
                

    $ sudo systemctl restart docker


  4. Remove sudo permissions for docker

    Copy
    Copied!
                

    $ sudo usermod -aG docker $USER


  5. Close the ssh window in the browser and reopen the session again from the left pane of ITadmin main page.

Single GPU

Copy
Copied!
            

#### Test nvidia-smi with the latest official CUDA image $ sudo docker run --gpus all nvidia/cuda:11.0-base nvidia-smi

© Copyright 2022-2023, NVIDIA. Last updated on Jan 10, 2023.