更新于2020-05-01
修改了Dockerfile文件的一些问题
张一极
基于centos
为了可复用的环境,docker在环境隔离和系统任务拉起方面有很大的优势,一个file,安装所有依赖。
1、安装
sudo yum install -y yum-utils \ device-mapper-persistent-data \ lvm2
设置仓库:
sudo yum-config-manager \ --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce docker-ce-cli containerd.io 安装最新版
sudo systemctl start docker run起来
FROM centosARG PYTHON_VERSION=3.7ARG TARGET_DIR=/home/ARG PIP="-i https://mirrors.aliyun.com/pypi/simple/"RUN yum install -y bzip2 \gcc \curl \git \wgetRUN wget --quiet https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh -O ~/anaconda.sh && \/bin/bash ~/anaconda.sh -b -p /opt/conda && \rm ~/anaconda.sh && \echo "export PATH=/opt/conda/bin:$PATH" >> ~/.bashrcENV PATH /opt/conda/bin:$PATHRUN pip install --upgrade pip $PIP && \pip --no-cache-dir install torch==1.2.0 $PIP && \pip install torchsummary==1.5.1 $PIP && \pip install pandas $PIP && \pip install numpy $PIP && \pip install torchvision==0.4.0 $PIPRUN echo "done"
源码地址:https://paste.ubuntu.com/p/wQvC9YZXz9/
xxxxxxxxxxdocker build -t pytorch:v0.1 .接着就可以run起来了,每一次镜像副本都可以复用,环境有新增组件就在dockerfile新增即可。