• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    Shell
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal Docker images for R

Minimal Docker images for R

What is R?

R is a free software environment for statistical computing and graphics. It compiles and runs on a wide variety of UNIX platforms, Windows and MacOS. See more at https://www.r-project.org/

Goals and features

The main goal of these images is to keep them minimal, so they can be used as part of a bigger (web) application, or as a base image. Currently the (R 4.1.0) r-minimal image is less than 21MB compressed, and 35.4MB uncompressed.

All images use Alpine Linux.

The images include the installr tools that can install R packages from CRAN or GitHub:

โฏ installr -h
Usage: ./installr [ -c | -d ] [ -a pkgs ] [ -t pkgs ] [ -r ] [ -p ] REMOTES ...

Options:
  -c    install C and C++ compilers and keep them
  -d    install C and C++ compilers, temporarily
  -a    install Alpine packages and keep them
  -t    install Alpine packages, temporarily
  -p    do not remove pak after the installation (ignored if -r is given).

REMOTES may be:
  * package names from CRAN/Bioconductor, e.g.    ggplot2
  * slugs of GitHub repos, e.g.                   tidyverse/ggplot2
  * GitHub branch, tag or commit, e.g             tidyverse/[email protected]
  * URLs to package .tar.gz files, e.g.           url::https://x.com/pkg.tar.gz
  * path to a local directory, e.g.               local::.

Recent r-minimal containers use pak (https://github.com/r-lib/pak) for R packages installation. If you have problems with pak, or need to install a package from a source that pak does not support, but the remotes package does, then install the remotes package first.

Limitations

To keep the images minimal, they do not include a number of parts and features that most users would prefer to have for interactive R development:

  • Recommended R packages are not installed.
  • Documentation is not included.
  • No X11 support.
  • No Java support.
  • No OpenMP support.
  • No JPEG, PNG or TIFF support.
  • No Cairo support.
  • No Tcl/Tk support.
  • No translations, only English.
  • The image does not have C, C++ or Fortran compilers.
  • Limited time zone data: GMT, UTC and America/New_York, see below if you need better time zone data.

Usage

Get the image from Docker Hub:

docker pull docker.io/rhub/r-minimal:latest

or from GitHub Packages:

docker pull docker.pkg.github.com/r-hub/r-minimal/r-minimal:latest

Platforms

All images are available on linux/amd64 and linux/arm64 platforms.

Supported R versions

Currently we support the last patch version of the last five minor R versions. The latest tag always uses the last R release.

image R version tags note
R devel 4.4.0-devel devel, 4.4.0, 4.4, 4.4.0-devel, 4.4-devel Built daily
R next 4.3.1-RC next, 4.3.1, 4.3, rc, 4.3.1-rc, 4.3-rc Built daily
R release 4.3.0 4.3.0, 4.3, release, latest
R 4.2.x 4.2.3 4.2.3, 4.2
R 4.1.x 4.1.3 4.1.3, 4.1
R 4.0.x 4.0.5 4.0.5, 4.0
R 3.6.x 3.6.3 3.6.3, 3.6
R 3.5.x 3.5.3 3.5.3, 3.5

Dockerfile examples

One of our main goals is to be able to use rhub/r-minimal as a base image, and easily add R packages from CRAN or GitHub to it, to create a new image. Run installr from a Dockerfile to add R packages to the r-minimal image:

FROM rhub/r-minimal
RUN installr praise
CMD [ "R", "--slave", "-e", "cat(praise::praise())" ]

Package with compiled code:

FROM rhub/r-minimal
RUN installr -d glue

After the package(s) have been installed, installr removed the compilers, as these are typically not needed on the final image. If you want to keep them use installr -c instead of installr -d.

Package with system requirements:

FROM rhub/r-minimal
RUN installr -d -t linux-headers pingr
CMD [ "R", "-q", "-e", "pingr::is_online() || stop('offline')" ]

Similarly to compilers, system packages are removed after the R packages have been installed. If you want to keep (some of) them, use installr -a instead of installr -t. (You can also mix the two.)

Popular packages:

Hints on installing some popular R packages:

package installr command ~ image size
data.table installr -d data.table 39.1 MB
dplyr installr -d dplyr 47.8 MB
ggplot2 installr -d -t gfortran ggplot2 82.1 MB
h2o See examples/h2o. 408.0 MB
knitr installr -d knitr 79.2 MB
shiny See examples/shiny. 84.1 MB
plumber See examples/plumber. 103.1 MB
rmarkdown installr -d rmarkdown 161.3 MB (including pandoc)
rstan See examples/rstan. 344.4 MB
tidyverse See examples/tidyverse. 302.5 MB
xgboost installr -d -t "gfortran libexecinfo-dev" -a libexecinfo xegboost 59.9 MB

See also the Dockerfiles in the examples directory.

Note that package and system dependencies change over time, so if any of these commands do not work any more, please let us know.

See the [examples/rmarkdown/Dockerfile] for installing pandoc.

Time zones

The image uses Rโ€™s internal time zone database, but most time zones are removed from, to save space. The only supported ones are GMT, UTC and America/New_York. If you need more time zones, then install Alpineโ€™s time zone package and point R to it:

apk add --no-cache tzdata
export TZDIR=/usr/share/zoneinfo

See also the discussion at #24

Known failures and workarounds

  • The ps package needs the linux-headers Alpine package at compile time. Many tidyverse packages depend on ps, so theyโ€™ll need it as well:

    installr -d -t linux-headers ps
    
  • The arrow package are hard to install, because Alpine Linux does not have the required libraries. For the details, please see: #7

  • The V8 package does not compile on Alpine Linux by default. Luckily, you can now download a static binary of V8:

    DOWNLOAD_STATIC_LIBV8=1 installr -d -t curl-dev V8
    
  • The prophet package depens on V8, through rstan, and you can use the same trick to install it:

    DOWNLOAD_STATIC_LIBV8=1 installr -d -t "linux-headers gfortran curl-dev" prophet
    
  • The readxl package does not compile on Alpine Linux currently. You can install this branch from GitHub:

    installr -d gaborcsardi/readxl@fix/alpine-linux
    
  • The tidyverse package depends on readxl, so youโ€™ll need to do the same:

    installr -d -t "curl-dev libxml2-dev linux-headers gfortran" \
        -a "libcurl libxml2" gaborcsardi/readxl@fix/alpine-linux tidyverse
    
  • To install the magick package, you need both the imagemagick and imagemagick-dev Alpine packages, both at install time and run time:

    installr -d -a "imagemagick imagemagick-dev" -t "curl-dev" magick
    

License

See https://www.r-project.org/Licenses/ for the R licenses

These Dockerfiles are licensed under the MIT License.

ยฉ R Consortium

More Repositories

1

rhub

R-hub API client
R
347
star
2

sysreqsdb

SystemRequirements mappings for R packages
Shell
135
star
3

pkgsearch

Search R packages on CRAN
R
107
star
4

cranlogs.app

RStudio CRAN mirror downloads, web app
JavaScript
100
star
5

proposal

r-hub: the everything-builder the R community needs. This is the original r-hub proposal, as submitted to the R Consortium
97
star
6

sysreqs

R package to install system requirements
R
80
star
7

cranlogs

Download Logs from the RStudio CRAN Mirror
R
79
star
8

cransays

Creates an Overview of CRAN Incoming Submissions ๐Ÿ“ฌ
R
77
star
9

crandb

Database of CRAN R packages
R
60
star
10

rhub2

The 'R-hub' package builder, v2
R
41
star
11

rversions

R versions, release dates and nicknames
R
39
star
12

evercran

Experimental
Shell
35
star
13

homebrew-cran

Building R binary packages using homebrew
Ruby
26
star
14

cranlike

Manage files in a CRAN-like repository
R
25
star
15

rhub-linux-builders

Docker configuration for the R-hub Linux builders
Perl
23
star
16

actions

GitHub Actions for R-hub
R
21
star
17

node-install-rstats

Download and install R, from node.js
JavaScript
16
star
18

jenkins-log-stream

Stream the output of a Jenkins job
JavaScript
15
star
19

containers

Docker containers for R-hub
Dockerfile
15
star
20

solarischeck

Scripts to R CMD check an R package on Solaris
Shell
11
star
21

blog

The R-hub blog
HTML
11
star
22

cchecksbadges

CRAN checks Badges
Ruby
10
star
23

rhub-server

Deploy your own R-hub-like server -- experimental
JavaScript
9
star
24

rhub-frontend

The R-hub web site. It stores uploads internally, and adds the submission to a message queue, to be picked up by another process
JavaScript
9
star
25

cran.github.io

CRAN @ github web page
CSS
7
star
26

cranatgh

Mirror CRAN @ GitHub
R
7
star
27

docs

R-hub documentation website
HTML
6
star
28

repos

Custom R package repositories โ€” work in progress!
5
star
29

api.app

The R-hub API
JavaScript
4
star
30

rversions.app

R versions web app
HTML
4
star
31

pandoc-builders

Docker images to build pandoc binaries for various Linux distributions
Makefile
4
star
32

rhub-node

Constants and utility functions for dealing with R and CRAN packages from node.js
JavaScript
4
star
33

rhub-backend

The back-end of r-hub. A node.js process that picks up submissions from a message queue, creates Jenkins jobs for them, and starts building the Jenkins job.
JavaScript
4
star
34

node-rversions

Query current and old R versions
JavaScript
3
star
35

sysreqs.app

R / CRAN package requirements online database and API
JavaScript
3
star
36

r-builder

Tools to build R
R
3
star
37

wincheck

R CMD check on Windows, in a (somewhat) isolated environment
PowerShell
2
star
38

feedback

r-hub feedback
2
star
39

localbuilder

Build binary Linux packages in R-hub Docker containers - Abandoned...
R
2
star
40

r-constants

R related information that does not change very often
JavaScript
2
star
41

r-builds

Shell
2
star
42

presentations

Presentations about r-hub
HTML
1
star
43

branding

R-hub branding
1
star
44

rhub-jenkins

Jenkins Docker image. It is based on the official image, and adds some capabilities to set the admin password, install plugins, etc., all via supplying environment variables
Shell
1
star
45

log

The captain's log
CSS
1
star
46

builddeps

Find the build-time dependencies of a package
R
1
star
47

rtools42

1
star
48

search

JavaScript
1
star
49

cran-mirror

R
1
star
50

macoscheck

R CMD check as a temporary user on macOS
Shell
1
star
51

mac-tools

Tools for R and R packages
1
star
52

rhubctrl

โš ๏ธ Work in progress! An R package that contains configuration information and functions to deploy and instance of r-hub. If you want to try r-hub on your local machine or server(s), you need this repository.
Ruby
1
star
53

ppa

Ubuntu packages for R-hub
Shell
1
star
54

rtools43

1
star
55

rtools44

Rtools44
1
star
56

repos-rpm

RPM packages for https://github.com/r-hub/repos
1
star
57

crandeps

R package to query CRAN (reverse) dependencies and calculate the full DAG
R
1
star