Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider use of littler install2.r scripts in the "Writing Dockerfiles" docs? #41

Open
cboettig opened this issue Jul 19, 2017 · 5 comments

Comments

@cboettig
Copy link

install2.r just provides a more concise syntax for adding R packages in Dockerfiles, it's available on all rocker images since we use it in the Rocker Dockerfiles too. One can just do:

RUN install2.r -e  bookdown rticles rmdshower

to install those packages.

Note that the repo is set by default (rstudio CRAN mirror on :latest, versioned images instead pull from the MRAN snapshots by default to ensure reproducibility).

The -e flag is optional, it makes install.packages() throw an error if the package installation fails (which will cause the docker build command to fail). By default, install.packages() only throws a warning, which means that a Dockerfile can build successfully even if it has failed to install the package.

@samvaltenbergs
Copy link

samvaltenbergs commented Oct 1, 2018

@cboettig we have had some changes to the firewalls and it's preventing Docker from establishing an SSL with the sites for downloading some of our packages via install2r.

I have tried passing in an environment variable to the R session in the Docker file as follows, but the R session doesn't seem to be picking it up:

RUN R -e "Sys.setenv(https_proxy = 'https://XXX.XXX.COM')" \
&& install2.r \
--error \
--deps FALSE \
data.table

I have also tried putting the following at the top of the Docker file in question, but that doesn't seem to work either:

ENV HTTPS_PROXY "https://XXX.XXX.COM"

Do you have any suggestions as to how I can get the R packages in install2.r to install using a proxy? Thanks for your help...

@cboettig
Copy link
Author

cboettig commented Oct 1, 2018

shooting from the hip here, but is not using the https url an option? e.g. install2.r -r http://cran.rstudio.com data.table ?

I'm not familiar with using https_proxy like this, but do you have this working as a pure R script instead of the install2.r way?

@samvaltenbergs
Copy link

@cboettig thanks for the response. With some help from Docker support and the network engineers, we've isolated the issue to some changes on our proxy server that aren't allowing curl to establish SSL connections. wget however, works okay inside a Docker container as long as one tells wget to use a proxy. So I think I need to try using a proxy - possibly using Sys.setenv(https_proxy = 'https://XXX.XXX.COM') - as well as telling install.packages() to use wget instead of the auto method that it defaults to.

I was looking over the documentation/code for install2.r and it doesn't look like there's an option to specify the method that install.packages() will use. Is that the case? If so, do you have another suggestion for installing packages in the Rocker image while being able to specify the method of install.packages()?

@cboettig
Copy link
Author

cboettig commented Oct 4, 2018

yeah, install2.r is really just a wrapper to make common patterns less writing. Recall that you can always just call install.packages() directly in your docker file, e.g.

RUN R -e "install.packages('httr', method='wget')"

etc

@samvaltenbergs
Copy link

Yup, can do, I just like the cleanliness of install2.r. Thanks VM for your quick responses!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants