To edit source code in a container, an editor must be installed in the container. This section presents several R integrated development environments that can be used within containers.
See also: GUI
1 RStudio IDE
RStudio IDE is the most popular IDE for R.
To use RStudio IDE on a container, RStudio Server should be installed in the container.
There are images rocker/rstudio
etc. with RStudio Server installed, which can be used to immediately run RStudio Server.
docker run --rm -ti -p 8787:8787 rocker/rstudio:4
For more information on how to use these images, please check the image reference pages.
Looking for Docker images for RStudio professional products? Check out the rstudio/rstudio-docker-products repository.
2 Jupyter
Jupyter is a web-based IDE that allows you to run Python and other programming languages interactively like notebook.
To use R on Jupyter, install the IRkernel
R package in addition to installing Jupyter itself.
rocker/binder
has already installed these and starts Jupyter Notebook by default.
docker run --rm -ti -p 8888:8888 rocker/binder:4
There are also Docker images with many R packages installed maintained by Project Jupyter, e.g. jupyter/r-notebook
.
docker run --rm -ti -p 8888:8888 jupyter/r-notebook:latest
3 VSCode
Visual Studio Code - Open Source (Code - OSS) is currently one of the most popular editors.
When editing R in VSCode, vscode-R is a popular extension. This extension is recommended to be used with languageserver
and httpgd
.
3.1 Visual Studio Code Dev Containers
The Microsoft’s Code OSS distribution, Visual Studio Code, has an extension, Dev Containers. (Formerly known as “Remote - Containers”.)
That makes a container the backend, which can be used to develop using software in the container.
The Dev Containers extension builds images from definition files and creates containers with installed VSCode Server and vscode extensions. Users can run the container and start working inside it without touching anything but the local VSCode.
The Dev Containers extension can load and use templates published on the web. The R’s definition is this, which installs languageserver
and httpgd
, and also installs radian
as R console.
This definition can also be used in GitHub Codespaces.
See also
3.2 coder/code-server and gitpod-io/openvscode-server
Both coder’s code-server and gitpod’s openvscode-server can run Code - OSS server-side and you can use it from the browser. To use them in a Docker container, they must be installed in the container.