Skip to content

jmgirard/rocker-bayes

Repository files navigation

rocker-bayes

This docker image provides everything you need for Bayesian data analysis in R. It comes with RStudio Server and Quarto on Ubuntu. Binary packages are accessed via bspm using install.packages().

Note, on a Windows host, you may want to increase the number of CPUs available to WSL via %UserProfile%\.wslconfig

Image Tags/Versions

Tag Base Image Operating System R RStudio CmdStan
latest jmgirard/rstudio2u "noble" (Ubuntu 24.04) 4.5.1 2025.05.1+513 2.36.0
noble jmgirard/rstudio2u "noble" (Ubuntu 24.04) 4.5.1 2025.05.1+513 2.36.0

Included R packages

Interfaces

Backends

Data Preparation

Model Interrogation

How to use

Option 1: Pull and run image

Some users will want to just install Docker Desktop, pull the image, and run it.

docker pull jmgirard/rocker-bayes
docker run -e PASSWORD=pass -p 8787:8787 jmgirard/rocker-bayes

Then navigate to http://localhost:8787 in your web browser and enter "rstudio" and "pass".
Use volumes or bind mounts to grant the container access to persistent storage or host directories.

Option 2: Build image locally

You could also download the Dockerfile from GitHub and build it yourself.

git clone https://github.com/jmgirard/rocker-bayes.git
cd rocker-bayes
docker-compose up --build -d

Then navigate to http://localhost:8787 in your web browser and enter "rstudio" and "pass".
You can also customize the port and password by editing .env in a text editor.

Test between-and-within-chain parallelization

Note that this small model won't get much benefit from within-chain parallelization.
It's just used to quickly test that everything is working.

library(brms)
fit_serial <- brm(
  count ~ zAge + zBase * Trt + (1|patient),
  data = epilepsy, family = poisson(),
  chains = 4, cores = 4, backend = "cmdstanr"
)
fit_parallel <- update(
  fit_serial, chains = 2, cores = 2,
  backend = "cmdstanr", threads = threading(2)
)

About

Dockerfile for Bayesian analysis in R

Topics

Resources

License

Stars

Watchers

Forks

Packages