This repo provides Docker images for geographic research and reproducing code from the books Geocomputation with R and Geocomputation with Python, building on the Rocker Project.
# Latest rocker/geospatial + geocompr dependencies
docker run -e PASSWORD=pw --rm -p 8786:8787 ghcr.io/geocompx/latest
# With up-to-date OSGeo packages and qgisprocess:
docker run -e PASSWORD=pw --rm -p 8786:8787 ghcr.io/geocompx/osgeoLog in at http://localhost:8786/ with username rstudio and the
password from the command (e.g. pw).
# Shell-only, no RStudio:
docker run -e PASSWORD=pw --rm -ti ghcr.io/geocompx/latest /bin/bash
# Bind-mount your working directory:
docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data -e PASSWORD=pw ghcr.io/geocompx/minimal
# Pin a specific version (date tag):
docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data -e PASSWORD=pw ghcr.io/geocompx/minimal:date_2024-10-14The R-enabled images (latest, minimal, osgeo, pythonr) support
VS Code Devcontainers. Open the repo in VS Code and it will detect the
.devcontainer/devcontainer.json configuration automatically.
The base image is rocker/geospatial from
rocker-versioned2. We
provide variants with different package sets and library versions:
Add :tagname after ghcr.io/geocompx/<image> for a specific version
(see
packages).
For users who want smaller images or different packages, a reference
minimal-slim/Dockerfile shows how to build
from rocker/r-ver without RStudio or heavy CLI tools, using
rocker-versioned2
scripts:
FROM rocker/r-ver:4.6.0
RUN apt-get update && apt-get install -y --no-install-recommends \
libgdal-dev libgeos-dev libproj-dev \
&& rm -rf /var/lib/apt/lists/*
RUN install2.r sf terra spDataAvailable rocker-versioned2 scripts: -
install_geospatial.sh
— GDAL, PROJ, GEOS + sf, terra, raster, stars, sp -
install_rstudio.sh
— RStudio Server with S6 supervisor -
install_python.sh
— Python 3 + reticulate -
install_tidyverse.sh
— Tidyverse stack -
install_quarto.sh
— Quarto CLI
The python image provides Python geospatial packages (pandas,
geopandas, movingpandas, osmnx, matplotlib, shapely, seaborn). The
pythonr image adds R on top.
docker pull ghcr.io/geocompx/python
docker run -e PASSWORD=pw --rm -ti ghcr.io/geocompx/python /bin/bash
python3 -c "import geopandas; print(geopandas.__version__)"For R + Python interop, run ghcr.io/geocompx/pythonr and use
reticulate from R.
The qgis image includes QGIS, GRASS, and SAGA.
docker run --rm -ti ghcr.io/geocompx/qgis /bin/bash
qgis --versionQGIS algorithms are accessible from R via qgisprocess:
pak::pak("paleolimbot/qgisprocess")
qgis_algs = qgisprocess::qgis_algorithms()
nrow(qgis_algs)
table(qgis_algs$provider)With GRASS and SAGA available as providers, you have access to ~970 algorithms.
For testing against recent GDAL/PROJ/GEOS versions:
docker run -d -p 8786:8787 -v $(pwd):/home/rstudio/data \
-e USERID=$UID -e PASSWORD=pw ghcr.io/geocompx/osgeodocker build qgis -t geocompx/qgis
docker build minimal -t geocompx/minimalSome images (suggests, rust) install packages from GitHub
repositories. Pass a GitHub PAT securely with BuildKit:
echo "your_github_token" > GITHUB_PAT.txt
DOCKER_BUILDKIT=1 docker build --secret id=GITHUB_PAT,src=GITHUB_PAT.txt -t geocompx/suggests suggests