Install Docker

Use docker instructions to get it up and running on your machine

Get and run rocker/geospatial

Rocker/geospatial is base collection of core r geospatial packages - includes most core packages and all dependencies

  1. In commmand line: docker pull rocker/geospatial
  2. In command line: docker run --rm -p 8787:8787 -e PASSWORD=testPWD rocker/geospatial
  3. In browser: http://localhost:8787/ username rstudio password as above

File IO

We may need to read and write local files to and from the container. To do so we can launch the docker mounting a local directory to a container location. Here the current directory (pwd) is mounted to a directory called data1

docker run -v "$(pwd)":/data1 -e PASSWORD=testPWD -p 8787:8787 rocker/geospatial

Then data in current directory would be accessible in the data1 directory. Perhaps more useful would be explicitly mounting locally and remotely:

docker run -v "/Users/colinr23/data":/work/data -e PASSWORD=testPWD -p 8787:8787 rocker/geospatial

Then in browser http://localhost:8787/ username rstudio password as above

And can read and write data to/from /work/data

setwd('/work')

x <- runif(100)

y <- runif(100)

df <- data.frame(x=x, y=y)

write.csv(df, 'data/file.csv')

And file.csv is now accessible on your local directory, /Users/colinr23/data in this case.

Other options

postgis docker

qgis docker

collection of earth analytics dockers