Hi there, I am trying to use renv with the rocker/shiny image. I pushed a minimal example to git, the Dockerfile looks like this:
FROM rocker/shiny:3.6.0
RUN Rscript -e 'install.packages(c("renv"), dependencies = TRUE, repos="http://cran.rstudio.com/")'
ADD app /srv/shiny-server/app
WORKDIR /srv/shiny-server/app
RUN Rscript -e 'setwd("/srv/shiny-server/app"); source(".Rprofile"); renv::restore()'
EXPOSE 3838
CMD ["/usr/bin/shiny-server.sh"]
However, somehow, R does not find the installed librarys. In the Docker logs, I keep getting this error:
app_1 |
app_1 | *** warning - no files are being watched ***
app_1 | [2020-05-11T08:28:55.488] [INFO] shiny-server - Shiny Server v1.5.13.944 (Node.js v12.15.0)
app_1 | [2020-05-11T08:28:55.491] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
app_1 | [2020-05-11T08:28:55.544] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
app_1 | [2020-05-11T08:28:55.549] [INFO] shiny-server - Starting listener on http://[::]:3838
app_1 | [2020-05-11T08:29:16.040] [INFO] shiny-server - Created bookmark state directory: /var/lib/shiny-server/bookmarks
app_1 | [2020-05-11T08:29:16.042] [INFO] shiny-server - Created user bookmark state directory: /var/lib/shiny-server/bookmarks/shiny
app_1 |
app_1 | *** '/var/log/shiny-server//hello-shiny-20200511-082915-39661.log' has been created ***
app_1 |
app_1 | *** '/var/log/shiny-server//rmd-shiny-20200511-082915-45759.log' has been created ***
app_1 |
app_1 | *** /var/log/shiny-server//hello-shiny-20200511-082915-39661.log ***
app_1 |
app_1 | Listening on http://127.0.0.1:39661
app_1 |
app_1 | *** /var/log/shiny-server//rmd-shiny-20200511-082915-45759.log ***
app_1 |
app_1 | Listening on http://127.0.0.1:45759
app_1 |
app_1 |
app_1 |
app_1 | processing file: index.Rmd
app_1 | output file: /tmp/RtmpCm5Lyd/index.knit.md
app_1 |
app_1 |
app_1 | Output created: /tmp/RtmpCm5Lyd/file153315df89.html
app_1 | [2020-05-11T08:29:22.545] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
app_1 |
app_1 | *** '/var/log/shiny-server//app-shiny-20200511-082921-34117.log' has been created ***
app_1 |
app_1 | *** /var/log/shiny-server//app-shiny-20200511-082921-34117.log ***
app_1 | * The project and lockfile are out of sync -- use `renv::status()` for more details.
app_1 | Warning message:
app_1 | The following package(s) are missing entries in the cache:
app_1 |
app_1 | BH, crayon, digest, htmltools, httpuv, jsonlite, later,
app_1 | magrittr, mime, promises, R6, Rcpp, rlang, shiny,
app_1 | shinydashboard, sourcetools, xtable
app_1 |
app_1 | These packages will need to be reinstalled.
app_1 |
app_1 | Error in loadNamespace(name) : there is no package called ‘digest’
app_1 | Calls: local ... loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
app_1 | Execution halted
I based my Dockerfile in this renv vignette:
When just runnign some R script with a rocker/r-base image, this worked fine.
I found these resources on packrat with Shiny+Docker, but they don't seem applicable to renv, because of the changed way renv deals with libraries:
Does anyone have experience with this? I am grateful for any help!