宿主机ubuntu22.4安装docker:
https://juejin.cn/post/7116127775462785054
宿主机是ubuntu22.4 ,编写dockerfile如下:
pythonFROM nvidia/cuda:11.6.2-devel-centos7
COPY deps /deps
RUN rm -rf /etc/yum.repos.d/* && cp /deps/CentOS-Base.repo /etc/yum.repos.d/ && yum clean all
RUN yum install wget opencv vim -y
RUN wget http://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/conda.sh && \
bash /tmp/conda.sh -b && rm /tmp/conda.sh && \
cp -f /deps/.condarc /root/
RUN ~/miniconda3/bin/conda init bash && . ~/.bashrc && conda create -n py37c python=3.7 -y
RUN . ~/.bashrc && conda activate py37c && pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U && pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip install fastapi uvicorn python-multipart requests opencv-python numpy
RUN . ~/.bashrc && conda activate py37c && conda install pytorch torchvision torchaudio cudatoolkit=11.6 -c pytorch -c conda-forge -y
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
宿主机执行:
pythondocker build -f Dockerfile . -t kevinchina/deeplearning:cuda11.6torch1.12.1base
本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!