1 Quick reference
- Source repository: rocker-org/rocker-versioned2
- Dockerfile
- tags
- rocker/rstudio
- rocker/tidyverse
- rocker/verse
- rocker/geospatial
- Published image details: rocker-org/rocker-versioned2’s wiki
- Non-root default user:
rstudio
2 Overview
These images are based on rocker/r-ver
, and RStudio Server is already installed.
The basic usage of these images is the same, with the difference being the amount of additional (R) packages installed.
rocker/tidyverse
has already installed the tidyverse package, some R Database Interface packages, and the Apache Arrow R package.rocker/verse
has already installed TeX Live and some publishing-related R packages, in addition to the packages installed inrocker/tidyverse
.rocker/geospatial
has already installed some geospatial R packages in addition to the packages installed inrocker/verse
.
These images start RStudio Server with the default command. Since the RStudio Server port is set to 8787
, you can open the RStudio screen on localhost:8787
from your browser with the following command.
docker run --rm -ti -p 8787:8787 rocker/rstudio
The non-root default user rstudio
is set up as RStudio Server user, so please enter the username rstudio
and a randomly generated password which is displayed in the console to the RStudio login form.
RStudio will not start if the default command (/init
) is overridden. To use R on the command line, specify the R
command as follows.
docker run --rm -ti rocker/tidyverse R
This document is for R 4.0.0 >= images. For R <= 3.6 images, please check the rocker-org/rocker-versioned repository and the rocker-org/geospatial repository.
4 How to use
4.1 Environment variables
Several special environment variables can be set to modify RStudio Server’s behavior.
4.1.1 PASSWORD
You can set a custom passoword to log in the RStudio instance. Please set your password as an environmental variable PASSWORD
like this:
docker run --rm -ti -e PASSWORD=yourpassword -p 8787:8787 rocker/rstudio
4.1.2 ROOT
If ROOT
is set to true
, the default non-root user will be added to the sudoers
group when the server init process.
docker run --rm -ti -e ROOT=true -p 8787:8787 rocker/rstudio
This configuration allows you to execute sudo
commands, like sudo apt update
, on the terminal on RStudio.
When using the sudo
command, you must enter the same password you used to log into RStudio.
4.1.3 DISABLE_AUTH
You can disable authentication for RStudio Server by setting an environmental variable DISABLE_AUTH=true
.
docker run --rm -ti -e DISABLE_AUTH=true -p 127.0.0.1:8787:8787 rocker/rstudio
With this example, when you visit localhost:8787
, you will now automatically be logged in as the user rstudio
without having to first enter a user name and password.
Use this setting only in a secure environment. Without authentication, anyone who has access to that port can log in the RStudio Server.
If you are using a container on your local computer, it is recommended that you configure the port publishing as -p 127.0.0.1:8787:8787
, as in the example, so that it can only be accessed from the same computer.
DISABLE_AUTH=true
setting only skips the RStudio log in page. So you will still need to enter the password when use the sudo
command with ROOT=true
option.
4.1.4 USERID
and GROUPID
The UID and GID of the default non-root user can be changed as follows:
docker run --rm -ti -e USERID=1001 -e GROUPID=1001 -p 8787:8787 rocker/rstudio
4.2 Setting files
Recent RStudio Server’s configuration files are saved in the ~/.config/rstudio/
directory1.
So, if you want to manage your RStudio configuration in Git, you can use a compose file such as the following:
services:
rstudio:
image: rocker/verse:4
ports:
- "8787:8787"
volumes:
- ./.rstudio_config:/home/rstudio/.config/rstudio