🛠️ Lab 5 — Configure and Verify GPU Access in Docker (50 pts)

Goal: Configure Docker to access an NVIDIA GPU using the NVIDIA Container Toolkit, verify the setup with a live nvidia-smi container run, and document each step — OR, if you don't have compatible GPU hardware, study the toolkit's architecture from its public release history and produce a labeled component diagram instead. Both paths use only free, local, or publicly available tools. Steps — Path A (you have an NVIDIA GPU and Linux or WSL2):

  1. Confirm your host already has a working NVIDIA driver installed by running nvidia-smi directly on the host (not in a container). Capture the output.
  2. Add the NVIDIA Container Toolkit's package repository following the official install guide, then install the toolkit with apt-get install nvidia-container-toolkit.
  3. Run nvidia-ctk runtime configure --runtime=docker and inspect the resulting /etc/docker/daemon.json to see exactly what changed.
  4. Restart the Docker daemon so the new runtime configuration takes effect.
  5. Verify end-to-end GPU access by running docker run --rm --gpus all nvidia/cuda:12.4.1-base-ubuntu22.04 nvidia-smi and confirming your GPU(s) appear in the container's output.
  6. Run one more test using --gpus device=0 and the NVIDIA_DRIVER_CAPABILITIES=utility environment variable, and note in your own words how the output differs (or doesn't) from Step 5.
  7. Write a short reflection (150–250 words) explaining, in your own words, why the toolkit configures the daemon rather than something baked into the image.

Steps — Path B (no compatible GPU hardware):

  1. Visit the NVIDIA Container Toolkit GitHub releases page and review the changelog for v1.19.1 and at least two prior minor releases.
  2. Identify and research the toolkit's core components (libnvidia-container, the nvidia-ctk CLI, the container runtime hook, device plugin integration, and EGL/WSL2 support).
  3. Create a labeled architecture diagram (hand-drawn and photographed, or built in any free diagramming tool) showing how a docker run --gpus all ... request flows from the Docker CLI through the daemon, the NVIDIA runtime hook, libnvidia-container, and finally to the host GPU driver.
  4. Write a short reflection (150–250 words) explaining, in your own words, why the toolkit configures the daemon rather than something baked into the image.

Deliverables: A text document (or PDF) containing your captured command output and reflection (Path A) or your diagram and reflection (Path B), submitted via online upload or text entry.