3.6 GPUs with Docker

NCP-AII · Control Plane Installation and Configuration (19% of the exam) · Official objective: “Demonstrate how to use NVIDIA GPUs with Docker.”

Running a sample GPU container to prove the whole chain works.

Key points

  1. A sample workload proves the whole chain works: driver, toolkit and Docker. NVIDIA runs nvidia-smi inside an ubuntu container with '--gpus all'. If the container prints the GPU table, Docker can use the GPUs.

    What NVIDIA says (1)

    “sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi”

    — NVIDIA Container Toolkit: Running a Sample Workload

  2. A sample workload proves the whole chain works: driver, toolkit, runtime and Docker. If nvidia-smi inside the container lists the GPUs, the setup is right.

    What NVIDIA says (2)

    “you can verify your installation by running a sample workload.”

    — NVIDIA Container Toolkit: Running a Sample Workload

    “sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi”

    — NVIDIA Container Toolkit: Running a Sample Workload

Key terms

Try it

Sample question

Which command does NVIDIA use to confirm Docker can see the GPUs after installing the toolkit and driver?

Show the answer

Answer: sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

A sample workload proves the whole chain works: driver, toolkit and Docker. NVIDIA runs nvidia-smi inside an ubuntu container with '--gpus all'. If the container prints the GPU table, Docker can use the GPUs.

What NVIDIA says (1)

“sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi”

— NVIDIA Container Toolkit: Running a Sample Workload

Practice 3.6 (2 questions) Full Control Plane Installation and Configuration guide

← 3.5 NVIDIA Container Toolkit · 3.7 NGC CLI on hosts →