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
To use RStudio IDE on a container, RStudio Server is 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.
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 Remote - Containers
The Microsoft’s Code OSS distribution, Visual Studio Code, has an extension, Remote - Containers. That makes a container the backend, which can be used to develop using software in the container.
The Remote - 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 Remote - Containers extension also includes ready-to-use sample definition files. 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.
3.2 code-server/openvscode-server
Both code-server and openvscode-server can run VSCode server-side and use VSCode from a browser. They can also be installed and used inside Docker containers.