为什么我在构建docker镜像时会出现各种依赖找不到 版本不对应的情况
【相关推荐】
还是先说requirements.txt
numpy
cmake
然后是Dockerfile
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
WORKDIR /app
COPY . .
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update && apt-get upgrade -y && apt-get install python3.6 python3-pip build-essential libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev libgtk-3-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgphoto2-dev libavresample-dev -y
RUN update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 2
RUN update-alternatives --list python
RUN python -V
RUN pip3 install -i https://mirrors.aliyun.com/pypi/simple/ -r requirements.txt
基础镜像主要由nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04这个配置,里面放好了CUDA和CUDNN
然后是拷贝项目文件(文件目录一会说),修改source源
安装一些依赖文件和最重要的Python3
接着把Python3设为系统默认版本
装个Python-pip,用pip安装requirements
到这里就把我们需要的基础镜像配置完了,编译命令是:
docker build -t yolo-env/v1.0 .