Docker 的旧版本被称为 docker,docker.io 或 docker-engine 。如果已安装,请卸载它们:
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
其他源参考链接:https://blog.csdn.net/M82_A1/article/details/98870376
sudo add-apt-repository "deb [arch=amd64] https://mirrors.ustc.edu.cn/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
其他版本安装参考:https://www.runoob.com/docker/ubuntu-docker-install.html
sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run hello-world
显示如下信息安装成功
官网地址:https://docs.docker.com/engine/install/ubuntu/
官网地址:https://github.com/NVIDIA/nvidia-docker
sudo systemctl start docker && sudo systemctl enable docker
# 设置stable存储库和GPG密钥:
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
# 要访问experimental诸如WSL上的CUDA或A100上的新MIG功能之类的功能,您可能需要将experimental分支添加到存储库列表中.
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker ## 重启docker
已经编译好的 Docker Image 在 Docker Hub 上,网址如下
https://hub.docker.com/r/pytorch/pytorch/tags?page=1&ordering=last_updated
https://hub.docker.com/r/anibali/pytorch/
官网NGC:https://ngc.nvidia.com/catalog/containers
可搜索指定版本
sudo docker pull pytorch/pytorch:1.8.1-cuda10.2-cudnn7-devel
查看现有镜像
sudo nvidia-docker images
sudo nvidia-docker run -it c7e20104018e /bin/bash
sudo nvidia-docker run -ti -d --rm c7e20104018e bash