Bootstrap

nvidia-container-toolkit安装问题(OpenPGP)

1.正常情况下

apt-get install -y nvidia-container-toolkit

2.使用nvidia源

nvidia-container-toolkit官网有安装教程
在这里插入图片描述

2.1 配置生产存储库

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

(可选)将存储库配置为使用实验性软件包

sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list

2.2 从存储库更新软件包列表

sudo apt-get update

2.3 安装 NVIDIA Container Toolkit 软件包

sudo apt-get install -y nvidia-container-toolkit

3.安装源报错

报错 gpg: no valid OpenPGP data found
报错 gpg: 找不到有效的 OpenPGP 数据

3.1获取下载源

仿造2中的步骤进行拆解,单独下载,对2.1的详细步骤。

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

(1)单独下载 gpgkey

wget https://nvidia.github.io/libnvidia-container/gpgkey

gpgkey内容为:

-----BEGIN PGP PUBLIC KEY BLOCK-----

mQINBFnNWDEBEACiX68rxIWvqH3h2GykO25oK9BAqV8fDtb6lXEbw3eKx4g87BRz
M3DQBA0S0IfkQ72ovJ33H50+gVTXuu+Zme5muWk72m3pApccZVDLqdzYlpWPruNb
MC+IlWr70yo8Jw8Zr1ihbWjFvMbDJTkgqPt2djNq3xxvdiKoZl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YS9t0MLXY9/PgJysuO41Ya4Ii43D3UK1wOHTmyHZHTCRDd
yuBE95bssDpwD/4jV9Pin3vAKa4hhn5GD4e478FNKRD58Q7qF3AhVTBNPIl1m4EF
X7sqI6cXUDG4BjpS70ZRWF2x51ZTiq7DLTV/gGw2okfVjoWjzQY0ebrLd4IoNs80
lIHmXxa+JdwB6WupCUzKCKLcPsX/yPAmswPNGAuIMAv+PWhUUSMVtzOZldnlogGM
hbJ9UD2txFGGh9WoYc2vgX9KAaKryXcC6QMabv7JJU24HEJJDgbJEvtFM5PS8QMF
bXIZsYgICWpQXVChBbduXo9sD2TUDWYAniNaaw4LKxPRG+Ix4HAqkh1oNOLojO30
DO3r1/62FKE5/ykg3iSMTDR0iOES/leXCCIO9fRJT8+eucxyOQoY5ti7tjt1wm3H
nTB+Rz3E/E2qeLs2PN82aseccm1G06pmsMCUiWtmSV6HjdO2XufYprrGLSu0RrT3
sz5WHGUOY2iO40xHhSiXg3TcLZRpv30DQzxoUrx9Ff//rXLFznh+MksuvVD2roUR
BGz/en31FxAcBoex9nNraeOekbFen5b7Xrq9wnzM5xZvJN2QYB3vS0khz/ZgFyy5
444ALa9gwb29FZCfA4m59S2QoB8uPQGM+8gnusE6J8y4fvI59ugafidIkt86dZ3m
FsEME5XNmBGdNEo2flRVFfpG1IWds2Ba3IsdbYd9nzmbBW7/n0InVRDrIg==
=9QWY
-----END PGP PUBLIC KEY BLOCK-----

(2)单独下载 nvidia-container-toolkit.list

wget https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list

nvidia-container-toolkit.list内容为:

deb https://nvidia.github.io/libnvidia-container/stable/deb/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/deb/$(ARCH) /

(3)步骤简化成
在这里插入图片描述
已经下载了以上两个文件

cat gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
cat nvidia-container-toolkit.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list

这样,我们就通过了2.1步骤了,就不会报‘找不到有效的 OpenPGP 数据’这个错。

3.2更新下载源

apt-get update

可能会报一下错误
在这里插入图片描述
GPG 错误:https://nvidia.github.io/libnvidia-container/stable/deb/amd64 InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY DDCAE044F796ECB0
使用以下命令进行处理:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DDCAE044F796ECB0
apt-get update

3.3 安装

apt-get install -y nvidia-container-toolkit

4.使用

重启docker后就能直接使用了:

systemctl daemon-reload

systemctl restart docker
;