由于业务要求,需要搭建运行coco数据集的环境。具体的环境配置要求如下:
ubuntu
pytorch: 1.6
torchvision: 0.7.0
detectron2: 0.2.1
cudatoolkit: 10.1
基础镜像
我选用的基础镜像为:registry.cn-huhehaote.aliyuncs.com/lumo/pytorch-with-tensorboard:1.5.1-cuda10.1-cudnn7-runtime
(这个镜像是 arena github 上提交 pytorch 任务的事例命令行中的镜像地址,里面已经安装好了 python3.7.7,anaconda,pytorch 1.5.1,nvidia-smi 10.1)
启动并进入容器
使用 docker pull 将上述镜像拉到本地,然后基于该镜像启动容器。
docker pull registry.cn-huhehaote.aliyuncs.com/lumo/pytorch-with-tensorboard:1.5.1-cuda10.1-cudnn7-runtime
docker images | grep registry.cn-huhehaote.aliyuncs.com/lumo/pytorch-with-tensorboard:1.5.1-cuda10.1-cudnn7-runtime (得到镜像id ${image_id})
docker run -it --name ${container_name} ${image_id} /bin/bash
开启与新容器的交互式命令行。
docker ps | grep ${container_name} (得到容器id ${container_id})
docker exec -it ${container_id} /bin/bash
安装环境
参考文章:detectron2云服务器部署 安装 测试
很优秀的文章,进入容器中基本就是按照上面的步骤做的。
安装 vim
apt update
apt install vim
修改 ubuntu apt 源
备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
修改:
vim /etc/apt/sources.li