diff --git a/docker/README.md b/docker/README.md index 493cf444a1c..faa24ae6d1f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -70,3 +70,44 @@ After build finished, run the container: ``` docker run --rm -it lightgbm ``` + +## Running the R-package Сontainer + +Build the container based on the [`verse` Rocker image](https://www.rocker-project.org/images/), for R users: + +``` +mkdir lightgbm-docker +cd lightgbm-docker +wget https://raw.githubusercontent.com/Microsoft/LightGBM/master/docker/dockerfile-r +docker build -t lightgbm-r -f dockerfile-r . +``` + +After the build is finished you have two options to run the container: + +1. Start [RStudio](https://www.rstudio.com/products/rstudio/), an interactive development environment, so that you can develop your analysis using LightGBM or simply try out the R package. You can open RStudio in your web browser. +2. Start a regular R session. + +In both cases you can simply call + +``` +library("lightgbm") +``` + +to load the installed LightGBM R package. + +**RStudio** + +``` +docker run --rm -it -e PASSWORD=lightgbm -p 8787:8787 lightgbm-r +``` + +Open the browser at http://localhost:8787 and log in. +See the [`rocker/rstudio`](https://hub.docker.com/r/rocker/rstudio) image documentation for further configuration options. + +**Regular R** + +If you just want a vanilla R process, change the executable of the container: + +``` +docker run --rm -it lightgbm-r R +``` diff --git a/docker/dockerfile-r b/docker/dockerfile-r new file mode 100644 index 00000000000..392bd7fa7f9 --- /dev/null +++ b/docker/dockerfile-r @@ -0,0 +1,10 @@ +FROM rocker/verse:latest + +WORKDIR /lgbm + +# R +RUN apt-get update && \ + apt-get install -y build-essential && \ + git clone --recursive --branch stable https://github.com/Microsoft/LightGBM && \ + cd LightGBM && \ + Rscript build_r.R