How can I start a Docker container and tell R to use a specific version of a system dependency being run in said container?

Viewed 127

I'm wanting to use the R package MODIStsp to download and process MODIS data, but currently there is an issue with GDAL's HDF4 driver package in my version of Linux (Manjaro). I've contacted the package maintainer, but in the mean time, I'd like to use a Dockerized version of GDAL on the backend to complete the task.

I know from within R it is possible to set the version of GDAL used ala

gdalUtils::gdal_setInstallation("/path/to/gdal/here")

My question is this: after I've pulled the osgeo/gdal image, how I can run the container in such a way to make it available to be used in R? And then how would the path get constructed in the function above?

1 Answers

I would turn this around and look into setting up a Docker container that has the versions of gdal (and then MODIStsp) that work for you.

I just updated a machine this morning running Ubuntu 20.04 with the usual PPA for CRAN packages (over 5000 of them) which relies on the underlying UbuntuGIS-stable PPA. That gave me, inter alia, GDAL 3.28 and rgdal 1.5-27 -- and I could just install MODIStsp 2.0.6 as a binary too.

I also have a couple of base container you could use for this, and could lend a hand if that is of interest.

Related