NVIDIA/nvidia-container-toolkit

How to install NVIDIA Container toolkit

Closed this issue · 20 comments

Hello,Everyone:
I have a problem that I encountered while using the NVIDIA Container Toolkit guid to install the NVIDIA Container Toolkit,There is an Issue when I follow the instructions on Ubuntu 22.04 WSL:

curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \ && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

The file ‘/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg’ already exists. Do you want to overwrite it? (y/N) curl: (35) OpenSSL SSL_connect: Connection reset by peer in connection to nvidia.github.io:443 y gpg: No valid OpenPGP data found.

I found a solution online that visit the website to look up the IP address of nvidia.github.io, Then Run the command sudo vim /etc/hosts and add the following content at the end of the file:
185.199.108.153 nvidia.github.io 185.199.109.153 nvidia.github.io 185.199.110.153 nvidia.github.io 185.199.111.153 nvidia.github.io
Finally, follow the official steps for installation. but this method doesn't seem to be effective. So what could be the reason for this? Are there any other methods for installation?

If you encounter the above issue, you need to change the image source:
sudo apt-get update sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo systemctl start docker sudo systemctl enable docker
sudo docker run hello-world
`curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io`

`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 |
sed 's#https://#https://mirrors.tuna.tsinghua.edu.cn/#g' | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
sudo docker run --gpus all --rm nvidia/cuda:10.0-base nvidia-smi
# Docker 阿里云源
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

NVIDIA Docker 阿里云源

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 |
sed 's#https://#https://mirrors.aliyun.com/#g' | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker`

Docker:

  1. sudo apt-get update
  2. sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  3. curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. sudo apt-get update
  6. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  7. sudo systemctl enable docker
  8. sudo systemctl start docker
  9. sudo groupadd docker
  10. sudo usermod -aG docker $USER
  11. docker run --rm hello-world

请问楼主是否解决了

请问楼主是否解决了

已经解决了,需要更换源

请问楼主是否解决了

已经解决了,需要更换源

请问添加的是什么源,请问一下

请问楼主是否解决了

已经解决了,需要更换源

请问添加的是什么源,请问一下

我添加的是清华镜像的源,只是有时候不太稳定,要多试几次

请问有源的链接吗,我现在的已经是清华源了,但是从来没有成功过

请问有源的链接吗,我现在的已经是清华源了,但是从来没有成功过

用这个试试,我是搭梯子在加上这个:curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

请问有源的链接吗,我现在的已经是清华源了,但是从来没有成功过

用这个试试,我是搭梯子在加上这个:curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

这个证书我已经安装成功了,是最后install的时候找不到安装包源

请问有源的链接吗,我现在的已经是清华源了,但是从来没有成功过

用这个试试,我是搭梯子在加上这个:curl -fsSL https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

我也成功了,用的手机usb共享热点安装好了这个gpg,公司的网就装不了

最后 install NVIDIA Container toolkit 能成功吗,我用的是云服务器,没法切换网络,但是服务器上已经可以翻墙的,还是一直报找不到源的问题

最后 install NVIDIA Container toolkit 能成功吗,我用的是云服务器,没法切换网络,但是服务器上已经可以翻墙的,还是一直报找不到源的问题

最后成功了。不知道是啥玄学问题。试试上面换成清华源

我执行
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 |
sed 's#https://#https://mirrors.aliyun.com/#g' | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

报gpg: 找不到有效的 OpenPGP 数据

apt-get install -y nvidia-docker2
这句也是报Unable to locate package nvidia-docker2

这个错,还是无法成功

我执行 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 | sed 's#https://#https://mirrors.aliyun.com/#g' | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

报gpg: 找不到有效的 OpenPGP 数据

apt-get install -y nvidia-docker2 这句也是报Unable to locate package nvidia-docker2

这个错,还是无法成功

试试这个链接里面的步骤,上次我是综合了这两个步骤就可以了,https://blog.csdn.net/Yonggie/article/details/140460258

见证奇迹的时刻发生了,竟然安装成功,非常感谢楼主
image

见证奇迹的时刻发生了,竟然安装成功,非常感谢楼主 image

没关系,后续有时间,我重新整理一下过程,前面的过程写的比较乱。

Docker:

  1. sudo apt-get update
  2. sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  3. curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. sudo apt-get update
  6. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  7. sudo systemctl enable docker
  8. sudo systemctl start docker
  9. sudo groupadd docker
  10. sudo usermod -aG docker $USER
  11. docker run --rm hello-world

If you see the message "gpg: No valid OpenPGP data found," you'll need to break down the installation steps from the official website as follows:

  1. In your web browser, navigate gpgkey and download the GPG file, saving it to your desktop.
  2. Run the command:cat gpgkey_path | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg,where gpgkey_path should be replaced with the path to your downloaded GPG file. For example: /home/XWL/filename.
  3. Similarly to the GPG installation process, nvidia-container-toolkit.list,and you should see the following:
deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/deb/$(ARCH) /
  1. Use the touch command to create a file named nvidia-container-toolkit.list. Copy and paste the content from step 3 into this newly created file, then save and exit.
  2. Run the following command:
cat /home/XWanL/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
  1. Execute sudo apt-get update.
  2. Finally, run sudo apt-get install -y nvidia-container-toolkit.

good

见证奇迹的时刻发生了,竟然安装成功,非常感谢楼主 image

老哥你好,我也遇到了跟你一样的问题,前面步骤都ok的,但是安装的时候都提示找不到包:
E: Unable to locate package nvidia-container-toolkit
E: Unable to locate package nvidia-container-runtime

E: Unable to locate package nvidia-docker2

想问下你后面是怎么突然就成功了呀?

Docker:

  1. sudo apt-get update
  2. sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release
  3. curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. sudo apt-get update
  6. sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  7. sudo systemctl enable docker
  8. sudo systemctl start docker
  9. sudo groupadd docker
  10. sudo usermod -aG docker $USER
  11. docker run --rm hello-world

If you see the message "gpg: No valid OpenPGP data found," you'll need to break down the installation steps from the official website as follows:

  1. In your web browser, navigate gpgkey and download the GPG file, saving it to your desktop.
  2. Run the command:cat gpgkey_path | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg,where gpgkey_path should be replaced with the path to your downloaded GPG file. For example: /home/XWL/filename.
  3. Similarly to the GPG installation process, nvidia-container-toolkit.list,and you should see the following:
deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/deb/$(ARCH) /
  1. Use the touch command to create a file named nvidia-container-toolkit.list. Copy and paste the content from step 3 into this newly created file, then save and exit.
  2. Run the following command:
cat /home/XWanL/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
  1. Execute sudo apt-get update.
  2. Finally, run sudo apt-get install -y nvidia-container-toolkit.

@wzystal 试试这个步骤