CentOS installation nvidia-container-toolkit error: No package available

Go through the installation process first

1. Set up docker-ce repository:

sudo yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

2. Install containerd.io package:

sudo yum install -y https://download.docker.com/linux/centos/7/x86_64/stable/Packages/containerd.io-1.4.3-3.1.el7.x86_64.rpm

3. Install the docker-ce software package:

sudo yum install docker-ce -y

Make sure the Docker service is running using the following command:

sudo systemctl --now enable docker

Finally, test your Docker installation by running the hello-world container:

sudo docker run --rm hello-world

It is normal to display as follows

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

4. Set up the nvidia-container-toolkit repository and GPG key:

distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.repo | sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo

Add the experimental branch to the repository list:

yum-config-manager --enable libnvidia-container-experimental

5. Install the nvidia-container-toolkit package after updating the package list:

sudo yum clean expire-cache
sudo yum install -y nvidia-container-toolkit

Configure the Docker daemon to recognize the NVIDIA container runtime:

sudo nvidia-ctk runtime configure --runtime=docker

After setting the default runtime, restart the Docker daemon to complete the installation:

sudo systemctl restart docker

At this point, you can test your working setup by running a basic CUDA container:

sudo docker run --rm --runtime=nvidia --gpus all nvidia/cuda:12.1.1-base-centos7 nvidia-smi

This should produce console output similar to the following:

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| 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 GTX 1080 Ti      Off| 00000000:01:00.0 Off |                  N/A |
| 20%   38C    P0               57W / 250W|      0MiB / 11264MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

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

Reason for error

Cannot be installed in a virtual environment

在第4步的储存库地址设置时使用了curl命令
而虚拟环境中的curl和本地源环境所使用的不是一个
所以储存库地址会设置错误
导致找不到nvidia-container-toolkit的软件包

Guess you like

Origin blog.csdn.net/weixin_46398647/article/details/130492565