| title |
|---|
rstudio, tidyverse, verse, geospatial |
- 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
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. (See image details for lists of installation packages)
rocker/tidyversehas already installed many R packages and their dependencies apt packages. e.g. thetidyversepackage, thedevtoolspackage, thermarkdownpackage, some R Database Interface packages, thedata.tablepackage, thefstpackage, and the Apache Arrow R package.rocker/versehas already installed TeX Live and some publishing-related R packages, in addition to the packages installed inrocker/tidyverse.rocker/geospatialhas 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/rstudioThe 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.
If your container system runs rootless, you will have to use the root
user to login instead, using the randomly generated password displayed in the console. In this case the privileges of the root user
in the container are already bounded by your regular user permissions
in the host system.
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:::{.callout-note}
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.
:::
The devel images are based on rocker/r-ver:devel,
witch install the latest R-devel daily snapshot.
devel tags are available for rocker/rstudio, rocker/tidyverse, and rocker/verse.
The latest-daily images are based on rocker/r-ver:latest and install the latest RStudio daily build.
latest-daily tags are available for rocker/rstudio, rocker/tidyverse, and rocker/verse.
rocker/geospatial:ubuntugis (rocker/geospatial:X.Y.Z-ubuntugis) and rocker/geospatial:dev-osgeo are special images
that differ slightly from the regular rocker/geospatial.
ubuntugisis built on packages installed from the ubuntugis-unstable PPA.dev-osgeois built on the latest release of PROJ, GDAL, and GEOS.
Several special environment variables can be set to modify RStudio Server's behavior.
:::{.callout-note}
The process of referencing these environment variables is done by the /init command,
which is the default command set for the container.
Therefore, if the /init command is not executed, nothing will happen.
For example, if you enter the container with the following command,
the uid of the user rstudio is unchanged and remains 1000.
docker run --rm -ti -e USERID=1001 -e GROUPID=1001 --user rstudio rocker/tidyverse bash:::
You can set a custom password 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/rstudioIf 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/rstudioThis configuration allows you to execute sudo commands, like sudo apt update, on the terminal on RStudio.
:::{.callout-note}
When using the sudo command,
you must enter the same password you used to log into RStudio.
:::
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/rstudioWith 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.
:::{.callout-warning}
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.
:::
:::{.callout-note}
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.
:::
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:::{.callout-warning}
If these are set, ownership of the /home/rstudio directory in the container is updated by the root user.
This will also overwrite the ownership of any files that are bind-mounted under the /home/rstudio directory.
:::
If you want to make repeated edits on RStudio Server, It would be useful to be able to share files edited on the container with the Docker host.
Here are some hints for doing this and a sample compose file (for docker compose).
- Recent RStudio Server's configuration files are saved in the
~/.config/rstudio/directory1. - It is not recommended to bind-mount whole home directory on the container (
/home/rstudio); RStudio Server may not work properly. - Since RStudio Server opens the user's home directory (
/home/rstudio) by default, it is easier to use if a working directory is set up under/home/rstudio, e.g./home/rstudio/workspace. However, for example, another directory such as the one containing CSV files should not necessarily have to be under the home directory, so it is recommended to bind-mount it under its own name directly under the root, e.g./other_dir.
services:
rstudio:
image: rocker/verse:4
ports:
- "8787:8787"
environment:
PASSWORD: yourpassword
volumes:
- ./.rstudio_config:/home/rstudio/.config/rstudio
- ~/workspace:/home/rstudio/workspace
- /other_dir:/other_dir