Skip to content

Commit

Permalink
add Dockerfile for R (#2308)
Browse files Browse the repository at this point in the history
* add Dockerfile for R

* update documentation and small fixes

part of code review in #2308

* add missing link in Docker README
  • Loading branch information
nuest authored and jameslamb committed Aug 12, 2019
1 parent 5cff4e8 commit 9cf6b82
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/README.md
Expand Up @@ -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
```
10 changes: 10 additions & 0 deletions 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

0 comments on commit 9cf6b82

Please sign in to comment.