无法在Docker映像中安装R软件包

时间:2018-12-29 11:21:16

标签: r docker dockerfile r-package ca

几天以来,我一直在docker映像构建期间安装R软件包时遇到问题:

> install.packages("devtools", repos = "https://mran.microsoft.com/snapshot/2018-10-25")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning: unable to access index for repository https://mran.microsoft.com/snapshot/2018-10-25/src/contrib:
  cannot open URL 'https://mran.microsoft.com/snapshot/2018-10-25/src/contrib/PACKAGES'
>
>
Warning message:
package ‘devtools’ is not available (for R version 3.4.4)

这是我的Dockerfile

FROM rocker/rstudio-stable:3.4.4

MAINTAINER Tazovsky

# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
    pandoc \
    pandoc-citeproc \
    pkg-config \
    libnlopt-dev \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libgsl-dev \
    libssl-dev \
    libssh2-1-dev \
    libssl1.0.0 \
    libxml2-dev \
    openssl

RUN apt-get update && apt-get install -y \
    libmpfr-dev

RUN apt-get install libcurl4-openssl-dev -y

# install java
RUN apt-get update && apt-get install -y openjdk-8-jdk openjdk-8-jre
RUN R CMD javareconf

# r-java
RUN apt-get install r-cran-rjava -y

RUN R -e 'install.packages("devtools", repos = "https://mran.microsoft.com/snapshot/2018-10-25")'

我确定它可以更早地工作(几周前)。

此外,我检查了命令

install.packages("devtools", repos = "https://mran.microsoft.com/snapshot/2018-10-25")

在本地有效。

我还尝试通过运行以下命令来添加CA证书:

本地:

openssl genrsa -des3 -out myCA.key 2048
openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem

Dockerfile中:

CP myCA.pem /tmp/myCA.pem
RUN cd tmp && \
    openssl x509 -in myCA.pem -inform PEM -out myCA.crt && \
    cp myCA.crt /usr/local/share/ca-certificates/myCA.crt && \
    update-ca-certificates && \
    rm -rf /tmp/*

但这没有帮助。

知道发生了什么吗?

1 个答案:

答案 0 :(得分:-1)

您可以尝试进行更改(对我有用)

SELECT customerId, SUM(AMOUNT) TOTAL_SPENT, SUM(CASE WHEN OrderType = 'over-the-phone' THEN amount END) OVER_THE_PHONE_SPENT
FROM TableName
WHERE customerId IN (SELECT customerId
                     FROM TableName
                     WHERE UPPER(storename) = "BECK'S CAKES"
                     AND UPPER(OrderType) = 'IN-PERSON')
GROUP BY customerId

install.packages("devtools", repos = "https://mran.microsoft.com/snapshot/2018-10-25")