Instaling new R packages on a Kubernetes interactive session

Hi all,

if an user starts an interactive session on Kubernetes with a docker container that includes R and some packages, is it possible for the user to install and try new packages? If yes, will the packages installed inside the container and the container will be updated?

Thanks very much,

By default, the packages will be installed in the user's HOME directory, which should be mounted from the outside, e.g. via NFS. This way the packages will persist between sessions without the need to alter the Docker image.

It get's more tricky if the R package requires any system libraries. In that case, the easiest approach is to provide an updated image with the necessary system library installed. Typically users do not have the permission to install packages at the system level. And even if those where granted, such changes would not persist between sessions.

Thanks for your answer !
I was thinking about installing the new package on the Docker image for maximum reproducibility.
If the user will change the packages in the HOME, the same script that was runned / tested in the interactive docker session can be not work in the same way as before.

Is there a way to install new packages inside the docker image directly from RStudioServer Pro interface, or it is required to update the container externally by changing the docker container recipe?

Thanks again!


Sorry for the late answer.

While it is possible (in principle) to enable users to install R packages within the running docker container, I am not aware of an easy way to enable these users to save the container as a docker iamge, which they could restart at a later time.

However, the question of reproducible environments is important to us. So important, that we have a separate sub-site for it:, which lists several workable solutions. For example, you could use the snapshot, which uses the renv package to record the state of a project specific library.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.