Updating the Docker Image on the RStudio Terraform Template

Updating the Docker Image on the RStudio Terraform Template

In my previous blog post I wrote about deploying R Studio in a container on OCI. If you remember, I mentioned that the terraform template in OCI creates a compute instance with a docker container running R version 4.1.1, released on 2021/08/10. The terraform template can be easily updated to use a different docker image, ideally with the latest R version, which at time of writing is 4.3.3 released on 2024/02/29. Here is how to do just that. 

Download the R terraform template. This can be obtained from oracle or downloaded from a previously created stack job. 

Within the downloaded template zip file, in the rstudio.yaml file we can see the docker image specified.

Currently this is using the rocker/rstudio:4.1.1 docker image. 

We can then edit this file to use whatever docker image we like. I have chosen to use the tidy verse:4.3.3 docker image, which gets the latest version of R and tidyverse. 

Other R docker images can be found here.

We can now use this edited template to create a new stack with an up-to-date version of R. 

Navigate to Developer Services → Resource Manager → Stacks

Change the compartment to correspond to where you wish the instance created to be located, and click “Create stack”.

From here you can select “My configuration” and upload a zip file of the edited template terraform configuration file. 

Click “Next” where you can specify the RStudio username and password.

In the review stage, make sure you check “Run apply” if you would like the resources required to be provisioned immediately. Then click “Create”.

A job is then started to create the stack.

When this is completed the URL to log into RStudio Server can be seen at the bottom of the logs.

Logging into this URL we can see the version of R is now the up to date 4.3.3 version.

To SSH onto the underlying compute instance you will need the private key, which is created automatically when the infrastructure is provisioned. For steps on how to find this for the created stack please see the end of my previous blog for instructions.