{"id":13858966,"url":"https://github.com/r-hub/r-minimal","last_synced_at":"2025-09-06T18:11:49.666Z","repository":{"id":39633312,"uuid":"228397475","full_name":"r-hub/r-minimal","owner":"r-hub","description":"Minimal Docker images for R","archived":false,"fork":false,"pushed_at":"2024-11-15T08:04:31.000Z","size":292,"stargazers_count":163,"open_issues_count":2,"forks_count":35,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-11-15T09:20:08.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-hub.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-16T13:49:47.000Z","updated_at":"2024-11-15T08:04:35.000Z","dependencies_parsed_at":"2023-01-19T17:04:48.040Z","dependency_job_id":"cec9df3b-801c-4ecc-9449-f5f18d305906","html_url":"https://github.com/r-hub/r-minimal","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-hub%2Fr-minimal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-hub%2Fr-minimal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-hub%2Fr-minimal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-hub%2Fr-minimal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-hub","download_url":"https://codeload.github.com/r-hub/r-minimal/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225938739,"owners_count":17548543,"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":[],"created_at":"2024-08-05T03:02:27.829Z","updated_at":"2025-07-14T01:32:29.664Z","avatar_url":"https://github.com/r-hub.png","language":"Shell","funding_links":[],"categories":["Shell","Docker"],"sub_categories":["R"],"readme":"---\noutput: github_document\neditor_options:\n  markdown:\n    wrap: 72\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  out.width = \"100%\"\n)\n```\n\n# Minimal Docker images for R\n\n## What is R?\n\nR is a free software environment for statistical computing and graphics.\nIt compiles and runs on a wide variety of UNIX platforms, Windows and\nMacOS. See more at \u003chttps://www.r-project.org/\u003e\n\n## Goals and features\n\nThe main goal of these images is to keep them minimal, so they can be used\nas part of a bigger (web) application, or as a base image. Currently the\n(R 4.4.1) `r-minimal` image is 23.74MB compressed, and 45.88MB\nuncompressed.\n\nAll images use Alpine Linux.\n\nThe images include the `installr` tools that can install R packages from\nCRAN or GitHub:\n\n```\n❯ installr -h\nUsage: ./installr [ -c | -d ] [ -e ] [ -a pkgs ] [ -t pkgs ] [ -r ] [ -p ] REMOTES ...\n\nOptions:\n  -c    install C and C++ compilers and keep them\n  -d    install C and C++ compilers, temporarily\n  -a    install Alpine packages and keep them\n  -t    install Alpine packages, temporarily\n  -p    do not remove pak after the installation (ignored if -r is given).\n  -e    use renv to restore the renv.lock file if present.\n\nREMOTES may be:\n  * package names from CRAN/Bioconductor, e.g.    ggplot2\n  * slugs of GitHub repos, e.g.                   tidyverse/ggplot2\n  * GitHub branch, tag or commit, e.g             tidyverse/ggplot2@v1.0.0\n  * URLs to package .tar.gz files, e.g.           url::https://x.com/pkg.tar.gz\n  * path to a local directory, e.g.               local::.\n```\n\nRecent r-minimal containers use [pak](https://github.com/r-lib/pak) for R\npackages installation. If you have problems with pak, or need to install\na package from a source that pak does not support, but the remotes package\ndoes, then install the remotes package first.\n\n## Limitations\n\nTo keep the images minimal, they do not include a number of parts and\nfeatures that most users would prefer to have for interactive R\ndevelopment:\n\n* Recommended R packages are not installed.\n* Documentation is not included.\n* No X11 support.\n* No OpenMP support. (But you can configure it for a package, see [examples/data.table](examples/data.table).)\n* No JPEG, PNG or TIFF support.\n* No Cairo support.\n* No Tcl/Tk support.\n* No translations, only English.\n* The image does not have C, C++ or Fortran compilers.\n* Limited time zone data: `GMT`, `UTC` and `America/New_York`, see\n  below if you need better time zone data.\n\n## Usage\n\nGet the image from\n[Docker Hub](https://hub.docker.com/repository/docker/rhub/r-minimal):\n\n```\ndocker pull docker.io/rhub/r-minimal:latest\n```\n\nor from [GitHub Packages](https://github.com/r-hub/r-minimal/packages/92808?version=latest):\n\n```\ndocker pull ghcr.io/r-hub/r-minimal/r-minimal:latest\n```\n\n## Platforms\n\nAll images are available on `linux/amd64` and `linux/arm64` platforms.\n\n## Supported R versions\n\nCurrently we support the last patch version of the last five minor R\nversions. The `latest` tag always uses the last R release.\n\n```{r, include = FALSE}\nsource(\"tools/calculate_tags.R\")\n```\n\n| image     | R version         | tags                   | note        |\n|-----------|-------------------|------------------------|-------------|\n| R devel   | `r rv(\"devel\")`   | `r rv_tags(\"devel\")`   | Built daily |\n| R next    | `r rv(\"next\")`    | `r rv_tags(\"next\")`    | Built daily |\n| R release | `r rv(\"release\")` | `r rv_tags(\"release\")` |             |\n| R 4.4.x   | `r rv(\"4.4\")`     | `r rv_tags(\"4.4\")`     |             |\n| R 4.3.x   | `r rv(\"4.3\")`     | `r rv_tags(\"4.3\")`     |             |\n| R 4.2.x   | `r rv(\"4.2\")`     | `r rv_tags(\"4.2\")`     |             |\n| R 4.1.x   | `r rv(\"4.1\")`     | `r rv_tags(\"4.1\")`     |             |\n| R 4.0.x   | `r rv(\"4.0\")`     | `r rv_tags(\"4.0\")`     |             |\n| R 3.6.x   | `r rv(\"3.6\")`     | `r rv_tags(\"3.6\")`     |             |\n\n## Daily R-devel builds\n\nWe tag our daily R-devel builds with the build date.\nThese images can be useful for tracking down bugs and\nregressions in R. E.g.:\n```sh\ndocker run -ti ghcr.io/r-hub/r-minimal/r-minimal:2022-11-25\n```\nThe tags start on 2021-07-25. `linux/arm64` images are available\nfrom 2022-01-13.\n\n## Dockerfile examples\n\nOne of our main goals is to be able to use `rhub/r-minimal` as a base\nimage, and easily add R packages from CRAN or GitHub to it, to create a\nnew image. Run `installr` from a `Dockerfile` to add R packages to\nthe `r-minimal` image:\n\n```dockerfile\nFROM rhub/r-minimal\nRUN installr praise\nCMD [ \"R\", \"--slave\", \"-e\", \"cat(praise::praise())\" ]\n```\n\nPackage with compiled code:\n\n```dockerfile\nFROM rhub/r-minimal\nRUN installr -d glue\n```\n\nAfter the package(s) have been installed, `installr` removed the compilers,\nas these are typically not needed on the final image. If you want to keep\nthem use `installr -c` instead of `installr -d`.\n\nPackage with system requirements:\n\n```dockerfile\nFROM rhub/r-minimal\nRUN installr -d -t linux-headers pingr\nCMD [ \"R\", \"-q\", \"-e\", \"pingr::is_online() || stop('offline')\" ]\n```\n\nSimilarly to compilers, system packages are removed after the R packages\nhave been installed. If you want to keep (some of) them, use `installr -a`\ninstead of `installr -t`. (You can also mix the two.)\n\nUsing with renv:\n\nTo use `renv` to restore the `renv.lock` file, use the `-e` option:\n\n```dockerfile\nFROM rhub/r-minimal\nCOPY .Rprofile .Rprofile\nCOPY renv renv\nCOPY renv.lock .\nRUN installr -d -e\n```\n\nIf you copy the entire folder with renv, including the `activate.R` and `.Rprofile`, renv will bootstrap itself with the same version as the lock and restore the packages with the proper versions.\nAll the necessary compilers and libraries needed at runtime need to be installed with the `-a` and `-t` options.\nPlease refer to [examples/renv-shiny](examples/renv-shiny) for an example that install shiny and rmarkdown in a container.\n\n\n## Popular packages:\n\nHints on installing some popular R packages:\n\n| package    | installr command                                                   | ~ image size (uncompressed) |\n|------------|--------------------------------------------------------------------|-----------------------------|\n| data.table | See [examples/data.table](examples/data.table) for OpenMP support  |  26.2 MB (50.0 MB)          |\n| dplyr      | `installr -d dplyr`                                                |  31.9 MB (59.7 MB)          |\n| ggplot2    | `installr -d -t gfortran ggplot2`                                  |  56.1 MB (93.5 MB)          |\n| h2o        | See [examples/h2o](examples/h2o).                                  | 354.0 MB (511.0 MB)         |\n| knitr      | `installr -d knitr`                                                |  25.3 MB (48.3 MB)          |\n| shiny      | See [examples/shiny](examples/shiny).                              |  49.8 MB (103.5 MB)         |\n| sf         | See [examples/sf](examples/sf).                                    |  79.7 MB (194.8 MB)         |\n| plumber    | See [examples/plumber](examples/plumber).                          |  56.3 MB (127.7 MB)         |\n| rmarkdown  | `installr -d rmarkdown`                                            |  58.1 MB (153.5 MB) (with pandoc) |\n| tidyverse  | See [examples/tidyverse](examples/tidyverse).                      | 113.7 MB (208.6 MB)         |\n| tidyverse w/o reprex  | See [examples/tidyverse-minimal](examples/tidyverse-minimal). | 66.5 MB (115.4 MB)    |\n| rstan      | See [examples/rstan](examples/rstan).                              |  92.0 MB (298.5 MB)         |\n| xgboost    | `installr -d -t \"gfortran libexecinfo-dev\" -a libexecinfo xgboost` |  35.5 MB (71.1 MB)          |\n\nSee also the `Dockerfile`s in the `examples` directory.\n\n\u003e Note that package and system dependencies change over time, so if any\n\u003e of these commands do not work any more, please\n\u003e [let us know](https://github.com/r-hub/r-minimal).\n\n\u003e See the [Dockerfile](examples/rmarkdown/Dockerfile) for installing pandoc.\n\n## Time zones\n\nThe image uses R's internal time zone database, but most time zones are\nremoved from, to save space. The only supported ones are `GMT`, `UTC` and\n`America/New_York`. If you need more time zones, then install Alpine's\ntime zone package and point R to it:\n\n```\napk add --no-cache tzdata\nexport TZDIR=/usr/share/zoneinfo\n```\n\nSee also the discussion at https://github.com/r-hub/r-minimal/issues/24\n\n## Known failures and workarounds\n\n* The ps package needs the `linux-headers` Alpine package at compile time.\n  Many tidyverse packages depend on ps, so they'll need it as well:\n\n  ```\n  installr -d -t linux-headers ps\n  ```\n\n* The arrow package needs a `Makevars` file to add a link flag. See the\n  example `Dockerfile` in the [examples/arrow](examples/arrow) directory.\n\n* The V8 packagees do not compile on aarch64 machines by default.\n  On x86_64 it installs fine:\n\n  ```\n  installr -d -t curl-dev V8\n  ```\n\n  This means that other packages that need V8 (e.g. rstan and prophet)\n  do not work on aarch64, either.\n\n* To install the magick package, you need both the `imagemagick` and\n  `imagemagick-dev` Alpine packages, both at install time and run time:\n\n  ```\n  installr -d -a \"imagemagick imagemagick-dev\" -t \"curl-dev\" magick\n  ```\n\n* pingr 2.0.4 does not build on Alpine, use the dev version:\n\n  ```\n  installr -d -t linux-headers r-lib/pingr\n  ```\n\n* Rcpp 1.0.13 [does not compile with R 4.4.2](\n  https://github.com/RcppCore/Rcpp/issues/1341). Use the dev version of\n  Rcpp until a new version is released on CRAN. This affects all packages\n  that depend on Rcpp, naturally. E.g. shiny, V8, rstan, odbc, golem,\n  prophet, pagedown, plumber, sf, etc. See the updated [examples].\n\n  ```\n  installr -d Rcppcore/Rcpp\n  ```\n\n## License\n\nSee \u003chttps://www.r-project.org/Licenses/\u003e for the R licenses\n\nThese Dockerfiles are licensed under the MIT License.\n\n© [R Consortium](https://github.com/rconsortium)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-hub%2Fr-minimal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-hub%2Fr-minimal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-hub%2Fr-minimal/lists"}