A Docker-based JupyterLab environment with R as the kernel, designed for reproducible data analysis. All R and Python package versions are pinned via renv.lock and requirements.txt so that the analysis environment can be reconstructed exactly on any machine.
- Getting Started
- HTTPS Support
- Package Management
- Pre-installed R Packages
- Pre-installed Bioconductor Packages
- Versioning
- License
- Docker Desktop
- Git
- mkcert — optional, for HTTPS support (see HTTPS Support)
git clone git@github.com:SamThilmany/JupyterLab-with-R--Docker-Environment.git
cd JupyterLab-with-R--Docker-Environmentcd jupyter-r
docker compose buildThe image is pinned to linux/amd64 because rawrr's .NET assembly is only available as an x86-64 binary on Linux. On Apple Silicon (M1/M2/M3/…), Docker Desktop runs the container via Rosetta 2 — no additional configuration is required.
Building downloads all R and Python packages and may take several minutes depending on network speed. If the build fails due to a transient download error, re-running the command is safe — Docker caches completed layers and renv retries failed package downloads automatically.
docker compose up -dThe container restarts automatically after Docker Desktop or system restarts.
Open a browser and navigate to:
https://localhost:8888— if HTTPS certificates are configured (see below)http://localhost:8888— fallback when no certificates are present
docker compose downJupyterLab can be served over HTTPS using a locally-trusted certificate generated by mkcert. This avoids browser security warnings without requiring any exceptions to be added manually.
brew install mkcert
mkcert -install
mkdir -p jupyter-r/certs
cd jupyter-r/certs
mkcert localhost 127.0.0.1
mv localhost+1.pem cert.pem
mv localhost+1-key.pem key.pemchoco install mkcert
mkcert -install
mkdir jupyter-r\certs
cd jupyter-r\certs
mkcert localhost 127.0.0.1
Rename-Item localhost+1.pem cert.pem
Rename-Item localhost+1-key.pem key.pemAfter placing the certificate files, restart the container:
docker compose restart jupyterThe server falls back to HTTP automatically when no certificate files are present, so the setup remains functional on machines without mkcert configured.
Note: The
jupyter-r/certs/directory is excluded from version control. Do not commit certificate files.
R packages are installed from renv.lock, which records the exact version of every package in the image. Python packages are pinned in requirements.txt. Both files are committed to the repository to ensure that any rebuild produces an identical environment.
- Add the package name to the appropriate list in
jupyter-r/install_packages.R. - Delete
jupyter-r/renv.lockto force a fresh install. - Rebuild the image:
docker compose build
- On the next
docker compose up, the updatedrenv.lockis copied to thenotebooks/directory. Move it tojupyter-r/and commit it:mv notebooks/renv.lock jupyter-r/renv.lock git add jupyter-r/renv.lock git commit -m "add <package-name>"
| Package | Description |
|---|---|
| IRkernel, IRdisplay, repr | R kernel for JupyterLab |
| languageserver | R language server for editor support |
| devtools | Package development tools |
| tidyverse | Collection of data science packages (dplyr, ggplot2, tidyr, …) |
| ggplot2 | Grammar of graphics plotting |
| ggfortify | ggplot2 extensions for statistical objects |
| ggforce | ggplot2 extension with additional geoms |
| ggtext | Markdown and HTML text rendering in ggplot2 |
| ggrepel | Non-overlapping text labels for ggplot2 |
| GGally | ggplot2 extension for matrix plots and model diagnostics |
| ggVennDiagram | Venn diagram geoms for ggplot2 |
| eulerr | Euler and Venn diagrams |
| patchwork | Composing multiple ggplot2 panels |
| cowplot | Plot arrangement and annotation |
| metR | Meteorological and geophysical field visualisation |
| scales | Scale functions for visualisation |
| showtext | Custom font rendering in R graphics |
| RColorBrewer | Colour palettes for data visualisation |
| doParallel | Parallel computing backend |
| combinat | Combinatorics utilities |
| s2 | Spherical geometry |
| Package | Description |
|---|---|
| rawrr | Direct access to Thermo raw mass spectrometry data |
| limma | Linear models for microarray and RNA-seq data |
| fgsea | Fast gene set enrichment analysis |
| clusterProfiler | Statistical analysis of functional gene clusters |
| enrichplot | Visualisation of functional enrichment results |
| DOSE | Disease ontology semantic and enrichment analysis |
| biomaRt | Interface to BioMart databases (Ensembl, etc.) |
| AnnotationDbi | Annotation database interface |
| org.Hs.eg.db | Human genome-wide annotation |
| ComplexHeatmap | Complex heatmap and annotation visualisation |
| circlize | Circular visualisation |
| MSstats | Statistical analysis of quantitative mass spectrometry data |
| MSstatsTMT | MSstats extension for TMT labelling experiments |
Semantic Versioning is used for versioning. For available versions, see the Releases.
This project is distributed under the Apache License 2.0. See LICENSE for more information.