Ubuntu 26.04

NVIDIA : Container Toolkit インストール2026/06/18

 

NVIDIA Container Toolkit をインストールすると、コンテナーから GPU を容易に利用可能となります。

[1]

こちらを参考に、ベースシステムに NVIDIA ドライバーをインストールしておきます。

[2]

こちらを参考に、Docker をインストールしておきます。

[3] NVIDIA Container Toolkit をインストールします。
root@dlp:~#
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | gpg --dearmor -o /etc/apt/keyrings/nvidia-docker.key

root@dlp:~#
wget https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list -O /etc/apt/sources.list.d/nvidia-container-toolkit.list

root@dlp:~#
sed -i -e "s/^deb/deb \[signed-by=\/etc\/apt\/keyrings\/nvidia-docker.key\]/g" /etc/apt/sources.list.d/nvidia-container-toolkit.list
root@dlp:~#
apt update

root@dlp:~#
apt -y install nvidia-container-toolkit

root@dlp:~#
systemctl restart docker

[4] コンテナーからの [nvidia-smi] コマンドの利用方法です。
root@dlp:~#
docker pull nvidia/cuda:12.9.2-cudnn-runtime-ubuntu24.04

root@dlp:~#
docker images

IMAGE                                          ID             DISK USAGE   CONTENT SIZE   EXTRA
nvidia/cuda:12.9.2-cudnn-runtime-ubuntu24.04   070f8f2672df       8.08GB         3.15GB

root@dlp:~#
docker run --gpus all nvidia/cuda:12.9.2-cudnn-runtime-ubuntu24.04 nvidia-smi


==========
== CUDA ==
==========

CUDA Version 12.9.2

Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.

This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license

A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.

Thu Jun 18 00:51:21 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.71.05              Driver Version: 595.71.05      CUDA Version: 13.2     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060        Off |   00000000:05:00.0 Off |                  N/A |
| 30%   39C    P8             16W /  170W |       1MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

# 対話セッションから [nvidia-smi]

root@dlp:~#
docker run --gpus all -it nvidia/cuda:12.9.2-cudnn-runtime-ubuntu24.04 /bin/bash

root@44567c03dcbc:/#
nvidia-smi

Thu Jun 18 00:52:46 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.71.05              Driver Version: 595.71.05      CUDA Version: 13.2     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 3060        Off |   00000000:05:00.0 Off |                  N/A |
| 30%   38C    P8             15W /  170W |       1MiB /  12288MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
関連コンテンツ