{"id":13706968,"url":"https://github.com/Haoen-Cui/baker-bayesian-analysis-in-docker","last_synced_at":"2025-05-05T23:31:57.944Z","repository":{"id":201613851,"uuid":"229515410","full_name":"Haoen-Cui/baker-bayesian-analysis-in-docker","owner":"Haoen-Cui","description":"Baker Project: Dockerfile for Bayesian Analysis ","archived":false,"fork":false,"pushed_at":"2019-12-31T10:48:05.000Z","size":2873,"stargazers_count":7,"open_issues_count":6,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-13T15:49:19.509Z","etag":null,"topics":["bugs","docker","jags","openbugs","pymc","pymc3","rstan","stan"],"latest_commit_sha":null,"homepage":"https://haoen-cui.github.io/baker-bayesian-analysis-in-docker","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Haoen-Cui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-22T03:57:01.000Z","updated_at":"2022-02-02T19:34:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"d08efa88-6bf4-45ee-8fbc-8f97390c66b3","html_url":"https://github.com/Haoen-Cui/baker-bayesian-analysis-in-docker","commit_stats":null,"previous_names":["haoen-cui/baker-bayesian-analysis-in-docker"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haoen-Cui%2Fbaker-bayesian-analysis-in-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haoen-Cui%2Fbaker-bayesian-analysis-in-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haoen-Cui%2Fbaker-bayesian-analysis-in-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Haoen-Cui%2Fbaker-bayesian-analysis-in-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Haoen-Cui","download_url":"https://codeload.github.com/Haoen-Cui/baker-bayesian-analysis-in-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252593239,"owners_count":21773436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bugs","docker","jags","openbugs","pymc","pymc3","rstan","stan"],"created_at":"2024-08-02T22:01:13.804Z","updated_at":"2025-05-05T23:31:56.660Z","avatar_url":"https://github.com/Haoen-Cui.png","language":"Dockerfile","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/Haoen-Cui/baker-bayesian-analysis-in-docker.svg?branch=master)](https://travis-ci.org/Haoen-Cui/baker-bayesian-analysis-in-docker)\n[![Star](https://githubbadges.com/star.svg?user=haoen-cui\u0026repo=baker-bayesian-analysis-in-docker)](https://github.com/haoen-cui/baker-bayesian-analysis-in-docker)\n\n## About\n\nThis project is named [`Baker`](https://haoen-cui.github.io/baker-bayesian-analysis-in-docker) because it provides a `Doc`**`ker`** image for **Ba**yesian analysis. In particular, it enables  \n\n- [`PyMC3`](https://docs.pymc.io/) with [`Jupyter`](https://jupyterlab.readthedocs.io/en/stable/) and [`miniconda3`](https://docs.conda.io/en/latest/miniconda.html)\n- [`Stan`](https://mc-stan.org/) using `R` through [`rstan`](https://cran.r-project.org/web/packages/rstan/index.html) and other related packages\n- [`BUGS`](https://www.mrc-bsu.cam.ac.uk/software/bugs/), in particular [`OpenBUGS`](http://www.openbugs.net/w/FrontPage), using [`R2OpenBUGS`](https://cran.r-project.org/web/packages/R2OpenBUGS/index.html)\n- [`JAGS`](http://mcmc-jags.sourceforge.net/) using [`rjags`](https://cran.r-project.org/web/packages/rjags/index.html)\n\nThe website for this project is available at [here](https://haoen-cui.github.io/baker-bayesian-analysis-in-docker). The project's goal is to help\n\n- *Students* to not need to install packages and complicated dependencies on their personal devices\n- *Professors*, *Instructors*, and *TAs* to relieve from being system admins for all their *students*\n- *Practitioners* to quickly spin up an environment to test out something interesting they find on the internet and to share their work with the world in an easily reproducible manner  \n\nIf you find this project helpful, please consider staring it and sharing the words. If you have any comments, concerns, or questions, please feel free to raise an [issue](https://github.com/Haoen-Cui/baker-bayesian-analysis-in-docker/issues).\n\n\n## Motivation\n\nI was first introduced to `WinBUGS` in an undergraduate Bayesian analysis course. Not knowing much modern computing technologies at the time, I had to visit *the* lab to use their Windows machines which have the software installed. Then, a couple years flew by, I took another Bayesian class in grad school which also required `OpenBUGS`. To make things worse, [iOS dropped support for 32 bit programs](https://developer.apple.com/documentation/uikit/app_and_environment/updating_your_app_from_32-bit_to_64-bit_architecture) in the middle of the semester after I spent significant amount to time configuring `wine`, `OpenBUGS`, and `R2OpenBUGS` on my MacBook. I know *now is the time*.\n\n\u003e Be the change you wish to see. ---- Mahatma Gandhi\n\n\n## Usage\n\nSome basic (*very little*) general knowledge of [`Docker`](https://docs.docker.com/) is needed. If one is interested in learning more, this [tutorial](https://docker-curriculum.com/) is a great source. We will present below a few common use cases.\n\nThe `Dockerfile` of this project is based on `rocker/verse:latest`, therefore sharing many similar usage. For example, to set up a `rstudio server` on local host, run\n```bash\ndocker run \\\n    -d \\\n    --rm \\\n    -p 8787:8787 \\\n    -e USER=\u003cusername\u003e \\\n    -e PASSWORD=\u003cpassword\u003e \\\n    --name \u003ccontainer_name\u003e \\\n    haoencui/baker\n```\nThen, visit `localhost:8787` in your browser with specified `\u003cusername\u003e` and `\u003cpassword\u003e`.\n\n- `-d`: to start a container in detached mode;\n- `--rm`: automatically remove the container when it exits;\n- `-p`: publish container port to host, `hostPort:containerPort`. One can pass multiple `-p` options. `8787` is used by `rstudio server`;\n- `-e`: set environment variable, i.e. username and password for rstudio server. `PASSWORD` is required and cannot be `\"rstudio\"`. If `USER` is omitted, then `\"rstudio\"` is used as default; and\n- `--name`: name of container for identification, can be omitted.\n\nThe `--volume` option (or `-v` in short) is also convenient to mount volume from local host (e.g. your laptop). For example, adding\n```bash\n--volume $(pwd):/home/\u003cusername\u003e/WORKSPACE\n```\nto the aforementioned `docker run` command will connect `~/WORKSPACE` inside the `Docker` container with current working directory (`pwd`) on your local host, i.e. the file system under the directory is shared and hence modification will be reflected in real time. For additional details on running `rstudio server`, please read [rocker wiki page](https://github.com/rocker-org/rocker/wiki/Using-the-RStudio-image).\n\nTo set up a `jupyter lab` on local host, run\n```bash\n# WARNING: THIS PROBABLY WON'T WORK AND IS RUN AS ROOT WITHOUT AUTH\ndocker run \\\n    -d \\\n    --rm \\\n    -p 9999:9999 \\\n    --volume $(pwd):/WORKSPACE \\\n    haoencui/baker \\\n    /bin/bash -c \\\n    \"jupyter notebook --allow-root --ip=0.0.0.0 --port=9999 --no-browser --NotebookApp.token='' --NotebookApp.password=''\"\n```\nThen, visit `localhost:9999` in your browser without the need to sign in.\n\nIf one needs to peek into the `Docker` container while it's running, use\n```bash\ndocker ps\n```\nto find the `\u003ccontainer-id\u003e` and run as `root` user via\n```bash\ndocker exec -it \u003ccontainer-id\u003e bash\n```\nand this will start a `bash` shell running inside the `Docker` container as identified by its ID.\n\nFor one-off scripts, one can execute them via\n```bash\ndocker run --rm haoencui/baker /bin/bash -c \"\u003csome-command\u003e\"\n```\nFor example, `\u003csome-command\u003e` can be `echo $HOME \u0026\u0026 echo $USER` or `Rscript file.R`. Don't forget the `--volume` option if you want to access or modify files on local host. But note that this will run as the `root` user so don't do something too crazy if you are also exposing your laptop's file system.\n\nLast but not least, don't forget to shutdown the containers using\n```bash\ndocker stop \u003ccontainer-id\u003e\n```\nand remove stopped containers, if you'd like\n```bash\ndocker container prune\n```\n\n\n## Contribution\n\n**Users wanted**: Please try out this project and let me know your thoughts. There are a few examples on the [project website](https://haoen-cui.github.io/baker-bayesian-analysis-in-docker) if you don't have a Bayesian model handy.\n\nI hacked together this project over a weekend before Christmas. This is also the first `Dcokerfile` I've ever built, so there are probably a lot of problems and room for improvements. Please feel free to raise an [issue](https://github.com/Haoen-Cui/baker-bayesian-analysis-in-docker/issues) and / or directly contribute. Your help is greatly appreciated.\n\n\n## Acknowledgement\n\nThis project is greatly inspire by the [rocker project](https://www.rocker-project.org/), [@jrnold's `rstan` `Dockerfile`](https://hub.docker.com/r/jrnold/rstan/dockerfile), and [@jonzelner's `rstan` `Dockerfile`](https://hub.docker.com/r/jonzelner/rstan/dockerfile).\n\nSpecial thanks to [@jsal13](https://github.com/jsal13) and [@patrick-boueri](https://github.com/patrick-boueri) for helping me debug my messy `docker build` logs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHaoen-Cui%2Fbaker-bayesian-analysis-in-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FHaoen-Cui%2Fbaker-bayesian-analysis-in-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FHaoen-Cui%2Fbaker-bayesian-analysis-in-docker/lists"}