docker {microCRAN} | R Documentation |
Running microCRAN as a Docker container
Description
A Dockerfile
with an init
-script is installed with this package, which
can be used for running a Docker container with this package.
The path to the directory with the file can be found by running
system.file('docker/', package = 'microCRAN', mustWork = TRUE)
Running
To run, place microCRAN's source-tarball in the build directory with the Dockerfile
.
Enable BuildKit and build the image:
DOCKER_BUILDKIT=1 docker build .
The build-process will automatically install any source-tarballed R-package
that is located in the build-context (i.e. directory with the Dockerfile
).
Start the container. Remember to map the port and the directory for the repository, else the repository is lost if the container is restarted. See the list below for variables to use.
docker run -d -v /data/my_local_cran:/var/cran -p 1881:1881 -e CRAN_DIR=/var/cran <microcran-image>
CRAN_HOST
Host for the service to listen to. See also plumber::pr_run.
CRAN_PORT
Port to listen on. Defaults to 1881.
CRAN_DIR
Path to root of local directory where the repository's files are stored.
CRAN_URL_PATH
Absolute path to the repository, as seen from the client.
CRAN_REDIRECT_URL
If static files should be served by something else.