安装docker
sudo apt install docker-compose
查看版本
docker version
添加 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 | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
这里自动下载的内容是与ubuntu18.04相对应,需要修改为
sudo vim /etc/apt/sources.list.d/nvidia-docker.list
deb https://nvidia.github.io/libnvidia-container/stable/ubuntu20.04/$(ARCH) /
#deb https://nvidia.github.io/libnvidia-container/experimental/ubuntu20.04/$(ARCH) /
deb https://nvidia.github.io/nvidia-container-runtime/stable/ubuntu20.04/$(ARCH) /
#deb https://nvidia.github.io/nvidia-container-runtime/experimental/ubuntu20.04/$(ARCH) /
deb https://nvidia.github.io/nvidia-docker/ubuntu20.04/$(ARCH) /
然后
cd /etc/apt/sources.list.d/; rm docker.list*
继续安装
sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo systemctl restart docker
拉取镜像,例子
sudo docker pull pytorch/pytorch:1.2-cuda10.0-cudnn7-devel
sudo docker pull ubuntu:18.04
查看镜像
sudo docker images
删除镜像
sudo docker image rm ff0fea8310f3
删除容器
sudo docker rm u18
启动容器
docker run --name u18 --gpus all -it --rm ubuntu:18.04 bash
sudo docker run --name SPGAN --gpus all -it -v /home/bxt21/Documents/TGRS:/home/TGRS/ 22645c78dd69 /bin/bash
创建自己的镜像
sudo docker commit -a="bixueting" -m="ubuntu18.04 and python3.6 and mitsuba2" u18 u18mitsuba2
版权声明:本文为Xueting_B原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。