What is RENV_PATHS_CACHE_HOST? -- docker documentation

277 views Asked by At

In the docker vignette/documentation, they give an example with a shiny app, but don't exactly specify what their parameters mean. Some of them are self explanatory, but others aren't. More specifically:

https://rstudio.github.io/renv/articles/docker.html

RENV_PATHS_CACHE_HOST=/opt/local/renv/cache
RENV_PATHS_CACHE_CONTAINER=/renv/cache
docker run --rm \
    -e "RENV_PATHS_CACHE=${RENV_PATHS_CACHE_CONTAINER}" \
    -v "${RENV_PATHS_CACHE_HOST}:${RENV_PATHS_CACHE_CONTAINER}" \
    -p 14618:14618 \
    R -s -e 'renv::restore(); shiny::runApp(host = "0.0.0.0", port = 14618)'

What is RENV_PATHS_CACHE_HOST? And is RENV_PATHS_CACHE_CONTAINER the location of where my cache will be upon running the image instance/container?

I'm not entirely sure how to use this example, but feel I'll need it.

1

There are 1 answers

2
Kevin Ushey On BEST ANSWER

The example here tries to demonstrate how one might mount an renv cache from the host filesystem on to a Docker container.

In this case, RENV_PATHS_CACHE_HOST points to a (theoretical) cache directory on the host filesystem, at /opt/local/renv/cache, whereas RENV_PATHS_CACHE_CONTAINER points to the location in the container where the host cache will be visible.