编程语言
首页 > 编程语言> > python-在docker映像中安装R

python-在docker映像中安装R

作者:互联网

如何在docker映像中安装R版本3.4.0.我已经使用以下命令安装了python

RUN yum -y install https://centos6.iuscommunity.org/ius-release.rpm \
  && yum -y install python36u \
  && yum -y install python36u-devel \
  && yum -y install python36u-pip \
  && yum -y install python36u-tkinter.x86_64

同样,我需要安装R:

到目前为止,我已经在文件中为R指定了以下内容:

ENV R_BASE_VERSION 3.4.0
RUN Rscript -e 'install.packages("devtools",dependencies=TRUE)' \
    &&Rscript -e 'install.packages("methods",dependencies=TRUE)' \
    &&Rscript -e 'install.packages("jsonlite",dependencies=TRUE)' \

请建议.我是Docker的新手

我认为我需要执行以下操作:

ENV R_BASE_VERSION 3.4.1

## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
    && apt-get install -t unstable -y --no-install-recommends \
        littler \
                r-cran-littler \
        r-base=${R_BASE_VERSION}* \
        r-base-dev=${R_BASE_VERSION}* \
        r-recommended=${R_BASE_VERSION}* \
        && echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
        && echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
    && ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
    && ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
    && ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
    && ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
    && install.r docopt \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
    && rm -rf /var/lib/apt/lists/*

但是我不知道这是什么垃圾.我只需要安装R,然后按照上面的说明安装所需的软件包.

编辑:我的docker文件中的第一行安装了node4.

解决方法:

这是两个安装Python的DockerFile,R和NodeJS

第一个安装Python 3.4.2,R 3.1.1和nodejs 4.8.4:

From node:4
RUN apt-get update && apt-get remove -y python && apt-get install -y python3 r-base
RUN cp /usr/bin/python3 /usr/bin/python

第二个安装了Python 3.5.3,R 3.4.1和nodejs 4.8.4:

From r-base:3.4.1
RUN apt-get update && apt-get install -y python3 nodejs
RUN cp /usr/bin/python3 /usr/bin/python

选择最适合您的需求.

标签:docker,dockerfile,python,r
来源: https://codeday.me/bug/20191111/2017738.html