Closed david-waterworth closed 6 years ago
Thanks for the report.
In any tagged image, the MRAN variable is already set as the CRAN mirror, so you can do getOption("repos")[["CRAN"]]
to get it.
On the latest
tags, this points to https://cran.rstudio.com/
instead, so that they remain latest
. However, you can still get the build date for that image (and your tagged images, like 3.4.3
) from MRAN
variable in /etc/environment
.
But you're absolutely right that setting in /etc/environment
doesn't cause it to be loaded at runtime into the system environmental variables. It would probably make sense to just add MRAN
and BUILD_DATE
to the global Renviron
for greater convenience.
Thanks for the explanation. I was actually trying to install RSQLServer using install2r i.e.
# rocker R base image
FROM rocker/r-ver:3.4.3
RUN install2.r --error --deps TRUE --repos $MRAN \
RSQLServer \
&& rm -rf /tmp/downloaded_packages/ /tmp/*.rds
It's not a problem though to use getOption("repos")[["CRAN"]]
to find the date then hard code that in the image.
Cheers Dave
Note that this is already the default setting, e.g.
docker run --rm -ti rocker/r-ver:3.4.3 install2.r RSQLServer
you should notice that package and it's dependencies are being installed from said MRAN mirror already without manually specifying --repos
.
Hi
That's odd, I tried it leaving out the repo today and it worked (used the MRAN repo). The other day it failed so appeared to be using CRAN, I'm not sure what I did wrong the first time around. Thanks for the help though - I understand a lot more how the container works.
Dave
Whilst the Dockerfile for the r-ver stack uses the $MRAN environment variable to install base packages from BUILD_DATE this doesn't appear to be available from the image, i.e.
>docker run -it rocker/r-ver:3.4.3
>Sys.getenv("MRAN")
[1] ""
I'm trying to install additional packages from the same MRAN snapshot in a derived Dockerfile (specifically RSQLServer as it's been removed from CRAN) so I'd like to be able to access the same environment variable used to build the original image. I'm not sure if I'm doing something wrong, but is this possible or can you please retain this variable post build?