5

Since couple of days I've been encountering problems with installing R packages during docker image build:

> 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)

Here is my 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")'

I'm sure it worked earlier (couple weeks ago).

Besides, I checked command

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

locally and it works.

I also tried to add CA certificate by running:

locally:

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

in 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/*

but it didn't help.

Any idea what's going on?

Taz
  • 5,755
  • 6
  • 26
  • 63
  • If you build an image with everything apart from that last `RUN` line, then start a container with that image and get a bash shell, can the system get that anything from that CRAN mirror via unix shell commands like `wget`? (You may need to `apt` install wget). – Spacedman Dec 29 '18 at 13:43
  • @Spacedman I can directly `wget` (only with option `--no-check-certificate`) or `curl` (only with `-k` option) tar.gz from CRAN/MRAN. Otherwise I get from `wget` error: `WARNING: The certificate of ‘mran.microsoft.com’ is not trusted. WARNING: The certificate of ‘mran.microsoft.com’ hasn't got a known issuer. HTTP request sent, awaiting response... 200 OK` – Taz Dec 29 '18 at 15:28

1 Answers1

0

You can try to change (it worked for me)

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

to

install.packages("devtools", repos = "http://cran.rstudio.com/")
help-info.de
  • 6,695
  • 16
  • 39
  • 41
Paquito
  • 31
  • 4