配置docker 支持GPU方法(Nvidia GPU)
系统版本:ubuntu 23.04。
参考官方文档:
https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
系统版本:ubuntu 23.04
执行脚本如下:
1.Configure the production repository:
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
Optionally, configure the repository to use experimental packages:
sed -i -e '/experimental/ s/^#//g' /etc/apt/sources.list.d/nvidia-container-toolkit.list
2.Update the packages list from the repository:
sudo apt-get update
3.Install the NVIDIA Container Toolkit packages:
sudo apt-get install -y nvidia-container-toolkit
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
bamfdaemon gnome-bluetooth gnome-screensaver indicator-applet indicator-application indicator-appmenu indicator-bluetooth indicator-common indicator-datetime indicator-keyboard
indicator-messages indicator-power indicator-printers indicator-session jayatana libaccounts-glib0 libbamf3-2 libevent-2.1-7a libgnome-panel0 libido3-0.1-0 libindicator3-7
liblightdm-gobject-1-0 libncurses5 libtinfo5 libunity-gtk2-parser0 libunity-gtk3-parser0 libunity-settings-daemon1 linux-headers-6.2.0-20 linux-headers-6.2.0-20-generic
linux-image-6.2.0-20-generic linux-modules-6.2.0-20-generic linux-modules-extra-6.2.0-20-generic node-arg node-create-require node-make-error node-typescript node-yn
ubuntu-touch-sounds unity-greeter unity-gtk-module-common unity-gtk2-module unity-gtk3-module unity-settings-daemon unity-settings-daemon-schemas
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit-base
The following NEW packages will be installed:
libnvidia-container-tools libnvidia-container1 nvidia-container-toolkit nvidia-container-toolkit-base
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,280 kB of archives.
After this operation, 17.0 MB of additional disk space will be used.
Ign:1 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container1 1.15.0~rc.3-1
Ign:2 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container-tools 1.15.0~rc.3-1
Ign:3 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit-base 1.15.0~rc.3-1
Ign:4 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit 1.15.0~rc.3-1
Ign:1 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container1 1.15.0~rc.3-1
Ign:2 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container-tools 1.15.0~rc.3-1
Ign:3 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit-base 1.15.0~rc.3-1
Ign:4 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit 1.15.0~rc.3-1
Ign:1 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container1 1.15.0~rc.3-1
Get:2 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container-tools 1.15.0~rc.3-1 [19.3 kB]
Get:3 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit-base 1.15.0~rc.3-1 [2,394 kB]
Get:4 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 nvidia-container-toolkit 1.15.0~rc.3-1 [945 kB]
Get:1 https://nvidia.github.io/libnvidia-container/experimental/deb/amd64 libnvidia-container1 1.15.0~rc.3-1 [922 kB]
Fetched 4,280 kB in 1min 33s (45.9 kB/s)
Selecting previously unselected package libnvidia-container1:amd64.
(Reading database ... 330620 files and directories currently installed.)
Preparing to unpack .../libnvidia-container1_1.15.0~rc.3-1_amd64.deb ...
Unpacking libnvidia-container1:amd64 (1.15.0~rc.3-1) ...
Selecting previously unselected package libnvidia-container-tools.
Preparing to unpack .../libnvidia-container-tools_1.15.0~rc.3-1_amd64.deb ...
Unpacking libnvidia-container-tools (1.15.0~rc.3-1) ...
Selecting previously unselected package nvidia-container-toolkit-base.
Preparing to unpack .../nvidia-container-toolkit-base_1.15.0~rc.3-1_amd64.deb ...
Unpacking nvidia-container-toolkit-base (1.15.0~rc.3-1) ...
Selecting previously unselected package nvidia-container-toolkit.
Preparing to unpack .../nvidia-container-toolkit_1.15.0~rc.3-1_amd64.deb ...
Unpacking nvidia-container-toolkit (1.15.0~rc.3-1) ...
Setting up nvidia-container-toolkit-base (1.15.0~rc.3-1) ...
Setting up libnvidia-container1:amd64 (1.15.0~rc.3-1) ...
Setting up libnvidia-container-tools (1.15.0~rc.3-1) ...
Setting up nvidia-container-toolkit (1.15.0~rc.3-1) ...
Processing triggers for libc-bin (2.37-0ubuntu2.2) ...
4.check installed
which nvidia-container-runtime
(base) gw00241401@gw00241401-pc:/data2/06_application/Docker-DB-GPT$ which nvidia-container-runtime
/usr/bin/nvidia-container-runtime
5.restart docker
sudo systemctl restart docker
6.run docker
docker run -it --gpus all ............................
更多推荐
所有评论(0)