The function uses the given Docker image and executes the given expressions. To access the session information, a directory is mounted from the host into the container, to which the R session in the container saves an RData file with the sessionInfo object.

extract_session_image(docker_image, expr = c(), container_dir = "/tmp",
  local_dir = tempfile(pattern = "extract_bind_"),
  deleteTempfiles = TRUE, container_name = "containerit_capturer")

Arguments

docker_image

The name of the Docker image to run

expr

A list of expressions to be executed in the session

container_dir

The directory in the container where a local temp directory is mounted to, for saving the session info to a file (in lack of a COPY instruction)

local_dir

The local directory mounted into the container

deleteTempfiles

Remove used local_dir directory when done

container_name

The name used to run the container (which will be removed at the end)

Value

An object of class session info

Note

This function was created for test purposes in order to compare sessionInfos.

Examples

extract_session_image("rocker/geospatial:3.3.3")
#> INFO [2019-08-20 16:44:02] Running R in container to obtain a session info using image rocker/geospatial:3.3.3 and command R --vanilla -e info <- sessionInfo() -e save(list = "info", file = "/tmp/capture.RData")
#> Detected API version '1.40' is above max version '1.39'; downgrading
#> O> #> O> R version 3.3.3 (2017-03-06) -- "Another Canoe" #> O> Copyright (C) 2017 The R Foundation for Statistical Computing #> O> Platform: x86_64-pc-linux-gnu (64-bit) #> O> #> O> R is free software and comes with ABSOLUTELY NO WARRANTY. #> O> You are welcome to redistribute it under certain conditions. #> O> Type 'license()' or 'licence()' for distribution details. #> O> #> O> R is a collaborative project with many contributors. #> O> Type 'contributors()' for more information and #> O> 'citation()' on how to cite R or R packages in publications. #> O> #> O> Type 'demo()' for some demos, 'help()' for on-line help, or #> O> 'help.start()' for an HTML browser interface to help. #> O> Type 'q()' to quit R. #> O> #> O> > info <- sessionInfo() #> O> > save(list = "info", file = "/tmp/capture.RData") #> O> > #> O> > #> INFO [2019-08-20 16:44:04] Wrote sessioninfo from Docker to /tmp/RtmpaH9WJK/extract_bind_5e4a3b385408/capture.RData
#> R version 3.3.3 (2017-03-06) #> Platform: x86_64-pc-linux-gnu (64-bit) #> Running under: Debian GNU/Linux 8 (jessie) #> #> Matrix products: #> #> Random number generation: #> RNG: #> Normal: #> Sample: #> #> locale: #> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C #> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 #> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C #> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C #> [9] LC_ADDRESS=C LC_TELEPHONE=C #> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C #> #> attached base packages: #> [1] stats graphics grDevices utils datasets methods base