-
Notifications
You must be signed in to change notification settings - Fork 155
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
Separate RENV Library Between Host and Docker -- Empty Docker RENV Library? #1602
Comments
If I'm reading https://docs.docker.com/engine/reference/builder/#env correctly, environment variables should be declared as:
That is, with an |
Still the same even with |
Ah, it's because you're using single quotes here:
Docker doesn't expand variables within single quotes. You need to use double quotes. |
This is what I have now and it's still not working... Could you share your docker file? # Source by Peter Solymos: https://hosting.analythium.io/best-practices-for-r-with-docker/
# Source by Nathaniel Haines: http://haines-lab.com/post/2022-01-23-automating-computational-reproducibility-with-r-using-renv-docker-and-github-actions/
# Source by Bill Mills: https://github.com/BillMills/Rocker-tutorial
# Source by Posit: https://solutions.posit.co/envs-pkgs/environments/docker/
# Source by renv vignette: https://rstudio.github.io/renv/articles/docker.html
FROM rocker/rstudio:4.3.1
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
build-essential \
curl \
gfortran \
libatlas-base-dev \
libbz2-dev \
libcairo2 \
libcurl4-openssl-dev \
libicu-dev \
liblzma-dev \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpcre3-dev \
libtcl8.6 \
libtiff5 \
libtk8.6 \
libx11-6 \
libxt6 \
locales \
tzdata \
zlib1g-dev
RUN apt-get install -y \
cmake \
make \
libcurl4-openssl-dev \
libssl-dev \
pandoc \
libxml2-dev
ENV RENV_VERSION 'v1.0.0'
RUN Rscript -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN Rscript -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"
## Doing renv restore
ENV PROJDIRECTORY "/home/rstudio/Documents/RStudio/PROJECT"
WORKDIR ${PROJDIRECTORY}
COPY renv.lock renv.lock
RUN mkdir -p renv/library
ENV RENV_PATHS_LIBRARY "${PROJDIRECTORY}/renv/library"
RUN Rscript -e "renv::restore()" As far as I can tell, |
For anyone interested in the future, I think I've figured out what the issue is -- it's probably specific to the use of Depending on how you do it, installing libraries during the docker build process puts the libraries in a place that you may be able to call with # Source by Peter Solymos: https://hosting.analythium.io/best-practices-for-r-with-docker/
# Source by Nathaniel Haines: http://haines-lab.com/post/2022-01-23-automating-computational-reproducibility-with-r-using-renv-docker-and-github-actions/
# Source by Bill Mills: https://github.com/BillMills/Rocker-tutorial
# Source by Posit: https://solutions.posit.co/envs-pkgs/environments/docker/
# Source by renv vignette: https://rstudio.github.io/renv/articles/docker.html
FROM rocker/rstudio:4.3.1
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
build-essential \
curl \
gfortran \
libatlas-base-dev \
libbz2-dev \
libcairo2 \
libcurl4-openssl-dev \
libicu-dev \
liblzma-dev \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpcre3-dev \
libtcl8.6 \
libtiff5 \
libtk8.6 \
libx11-6 \
libxt6 \
locales \
tzdata \
zlib1g-dev
RUN apt-get install -y \
cmake \
make \
libcurl4-openssl-dev \
libssl-dev \
pandoc \
libxml2-dev
USER rstudio
ENV RENV_VERSION 'v1.0.0'
RUN Rscript -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN Rscript -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"
## Doing renv restore
ENV PROJDIRECTORY "/home/rstudio/Documents/RStudio/PROJECT"
WORKDIR ${PROJDIRECTORY}
COPY renv.lock renv.lock
RUN mkdir -p renv/library
COPY .Rprofile .Rprofile
COPY renv/activate.R renv/activate.R
RUN R -e "renv::restore()"
USER root Something to note is that this current version of the Dockerfile may not be computationally reproducible, strictly speaking, one of the biggest reasons being the use of the |
Hello,
I was looking through the
renv
documentation and other guides, and I've hit a hurdle that I'm having trouble getting through.I've put my dockerfile here and attached my renv.lock
The context is that I have a RStudio project locally with its own renv library that I'd like to transition to a Docker image. However, I'd still like the local renv library to be accessible and I want it to be separate from the Docker image's renv library to ensure computation reproducibility.
However, although my current Dockerfile seems to be install the packages, it installs it into
/usr/local/lib/R/site-library
and/usr/local/lib/R/library
instead of${PROJDIRECTORY}/renv/library
... and I can't figure out why... Would greatly appreciate any helpThis is what I run to build the image at the root of the R Studio project
sudo docker build -t project .
This is what I run to start the image at the root of the R Studio project
The text was updated successfully, but these errors were encountered: