today I’d like to point to the Rocker project, which provides a suite of Docker images for particular tasks. Even though the Rocker initiative already exists since 2014 and I read about it once in a while, there were not many use cases for me to try it out.
However, I recently stumbled upon problem where Rocker proved to be a really convenient solution. I was trying to get some R – GIS bridges (QGIS, SAGA, GRASS) and V8 running on my Manjaro Linux System. Unfortunately, I quickly realized that all this would really mess up my system for several reasons. I would have needed to install a large number of dependencies, some of which were rather large in terms of required disk space. In addition, I would have needed to downgrade SAGA and QGIS in order to get them running through R.
This is when a Docker containers come in really handy, as things basically work out of the box without messing up your system and without the need to grapple with dependencies. I simply used the Geocomputation with R docker image and ran RStudio in my browser.
Here’s a short description on how to get a rocker image running. First install docker on your system (Manjaro is based on Arch Linux and thus uses the pacman package manager):
# update system sudo pacman -Syu # install docker sudo pacman -S docker # run and enable docker at startup sudo systemctl start docker sudo systemctl enable docker # configure docker user sudo usermod -aG docker $USER
Note that the last line enables users without sudo privileges to run docker.
Once you have installed docker, you can pull docker images and run them:
# pull image docker pull robinlovelace/geocompr # run image
docker run -e PASSWORD=pass --rm -p 8787:8787 robinlovelace/geocompr
You can now open up RStudio server in your browser by navigating to http://localhost:8787/. Use
rstudio as username and
pass as password.
After login you are in a RStudio server session running in your docker container with access to all pre-installed packages.
For the sake of simplicity, I added a docker run alias to my
alias geoR="docker run -d -e PASSWORD=pass -p 8787:8787 -v /home/ms/Git:/home/rstudio/Git robinlovelace/geocompr"
-v flag mounts the
Git folder (containing my GitLab projects) from my local home directory to be accessible in the RStudio session running in the docker container. For a detailed description of used flags, see the documentation of docker run.