yolov5部署docker

为什么我在构建docker镜像时会出现各种依赖找不到 版本不对应的情况

img

【相关推荐】



  • 这篇博客: 如何把yolov3封装到Docker里面运行 | Dockerfile的编写与编译中的 2.1在基础镜像搭建基础环境 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:

    还是先说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 .

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^