分析脚本搭建docker环境:python, R
Posted snow-backup
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了分析脚本搭建docker环境:python, R相关的知识,希望对你有一定的参考价值。
1. 搭建Anaconda Python3.6
FROM nvidia/cuda:8.0-cudnn6-devel-ubuntu16.04 MAINTAINER Tyan <tyan.liu.git@gmail.com> # Install basic dependencies RUN apt-get update && apt-get install -y --no-install-recommends build-essential cmake git wget libopencv-dev libsnappy-dev python-dev python-pip tzdata vim # Install anaconda for python 3.6 RUN 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" >> ~/.bashrc # Set timezone RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime # Set locale ENV LANG C.UTF-8 LC_ALL=C.UTF-8 # Initialize workspace RUN mkdir /workspace WORKDIR /workspace
2. dockerfile 安装python包
COPY requirements.txt /tmp/ RUN pip install --requirement /tmp/requirements.txt COPY . /tmp/
3. 搭建R环境
FROM r-base # 安装包 RUN R -e "install.packages(‘remotes‘); remotes::install_version(‘tidystringdist‘, ‘0.1.2‘)" RUN mkdir /home/analysis COPY myscript.R /home/analysis/myscript.R # 运行 CMD cd /home/analysis && R -e "source(‘myscript.R‘)" && mv /home/analysis/p.csv /home/results/p.csv
已有R的docker image: https://github.com/rocker-org/rocker
以上是关于分析脚本搭建docker环境:python, R的主要内容,如果未能解决你的问题,请参考以下文章
在Linux环境中,使用docker环境搭建notebook进行python学习,使用官方镜像快速创建docker环境,快速创建环境学习相关技术,不要把时间浪费在环境搭建上