If you want to mount other volumes inside the Docker container, you
can use parameter volumes
. This requires a data.frame with
two columns named local
and docker
.
local
contains path to local computerdocker
contains path inside the docker container linked
to localThe main project directory will be directly accessible at the root of
RStudio server inside the Docker. It is called in path
parameter.
tempdir <- tempdir()
my_project <- normalizePath(file.path(tempdir, "myproject"), mustWork = FALSE)
dir.create(my_project)
#> Warning in dir.create(my_project): '/tmp/RtmpWasbWI/myproject' already exists
The following directory will be mounted inside the Docker container at a chosen place. In this example, we will link the additional directory inside RStudio home directory (aside the main project).
# Which container with RStudio server? ----
container <- "rocker/geospatial:4.0.1"
# Which port ? ----
# _Useful if multiple Rstudio Server to launch
port <- 8788
# Start Docker project
launch_proj_docker(path = my_project,
container = container,
port = port,
volumes = volumes)
# Stop Docker properly
stop_proj_docker(path = my_project, sleep = 5)