Run in a Docker container

knitr::opts_chunk$set(echo = TRUE)

A dockerised version of sen2r is available here: it contains a working RStudio environment with the package sen2r and all its dependencies (both R packages and runtime dependencies). It can be used in order to avoid troublings about compiling all the required R packages, or in case of problems with runtime dependencies (typically GDAL over Windows).

To use it:

  1. install Docker CE version 1.13 or higher;

  2. read the docker documentation in Part 1;

  3. obtain the image of sen2r: {bash, eval = FALSE} docker pull ranghetti/sen2r:latest where latest corresponds to the software version in branch main (see here all the available docker tags);

  4. run the docker: {bash, eval = FALSE} docker run --rm -e PASSWORD=sen2r -e USERID=$(id -u) -v $(pwd):/home/rstudio/host -p 8777:8787 ranghetti/sen2r where:

    • -e PASSWORD=sen2r is the password to be used to login;
    • -v $(pwd):/home/rstudio/host means that the current directory will be mounted in the docker, and its content will be available in the subdirectory host of the docker folder tree (to mount a different directory, replace $(pwd) with the desired directory);
    • -p 8777:8787 means that the dockerised RStudio will be accessible from port 8777 (change it to use a different port).
  5. access to the RStudio environment from http://localhost:8777, logging in with user rstudio and the password set as above;

  6. for online use, add the user's SciHub credentials using the GUI or with the function: r library(sen2r) write_scihub_login("<scihub_username>", "<scihub_password>")

Try the sen2r package in your browser

Any scripts or data that you put into this service are public.

sen2r documentation built on Nov. 10, 2023, 9:08 a.m.