Skip to content

Latest commit

 

History

History
76 lines (52 loc) · 2.69 KB

binder.md

File metadata and controls

76 lines (52 loc) · 2.69 KB
title
binder

Quick reference

Overview

This image is based on rocker/geospatial and configured to run RStudio Server on Binder, thanks to jupyter-rsession-proxy.

For instructions on how to use this image with Binder for your project, see the rocker-org/binder, a template repository.

By placing the following badge {fig-alt="Binder"} in README.md of your project, RStudio can be started and used in the browser by simply clicking on the badge.

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/<GITHUB_USER>/<REPO>/<BRANCH>?urlpath=rstudio)

You can also make a Binder badge with usethis::use_binder_badge() R function.

:::{.callout-note}

This document is for R 4.0.0 >= images.

:::

How to use

Use outside of Binder

If you use this image with Docker, the default command runs JupyterLab. Since the JupyterLab port is set to 8888, you can open the JupyterLab screen on localhost:8888 from your browser with the following command.

docker run --rm -ti -p 8888:8888 rocker/binder

You can log in by entering the token displayed in the terminal as your password.

If you want to set your own password for Jupyter, you can set it as a environment variable JUPYTER_TOKEN1.

docker run --rm -ti -e JUPYTER_TOKEN=yourpassword -p 8888:8888 rocker/binder

:::{.callout-tip}

RStudio Server started from Jupyter does not read environment variables set at container startup; if you want to use environment variables on your RStudio instance, set them on the .Renviron file.

:::

To run RStudio Server directly as in rocker/rstudio, execute /init command with the root user specified.

docker run --rm -ti -p 8787:8787 --user root rocker/binder /init

Footnotes

  1. Jupyter Server Config file and command line options