【云原生】Ubuntu 22 安装 Docker 并使能 NVIDIA 环境
【1】卸载原有 Docker
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done
【2】安装 Docker
【2.1】设置 Docker 密钥与仓库
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg
添加 Docker 官方 GPG Key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
--------------------------------------------------
设置仓库
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
--------------------------------------------------
【2.2】安装 Docker 引擎
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
【2.3】安装验证 docker compose
sudo apt-get update
sudo apt-get install docker-compose-plugin
docker compose version
Docker Compose version vN.N.N
curl -SL https://github.com/docker/compose/releases/download/v2.19.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
docker-compose version
【3】安装 nvidia-container-runtime
curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | \
sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | \
sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
sudo apt-get update
sudo apt-get install nvidia-container-runtime
参考与致谢
本博客为博主学习笔记,同时参考了网上众博主的博文以及相关专业书籍,在此表示感谢,本文若存在不足之处,请批评指正。
【1】https://docs.docker.com/engine/install/ubuntu/
【2】ubuntu(22)安装docker 文章来源:https://www.toymoban.com/news/detail-558348.html
【3】nvidia-container-runtime - github 文章来源地址https://www.toymoban.com/news/detail-558348.html
到了这里,关于【云原生】Ubuntu 22 安装 Docker 并使能 NVIDIA 环境的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!