Rocker/RStudio container update

Hi All,
I would like to update Rstudio version in my existing container where I have got all installed my selected packages which I often work with. How do I do it ?

Any help greatly appreciated.

Update your dockerfile then rebuild your image.

Thank you, could you please explain it in a bit more detailed way how to do it ?

post your existing dockerfile and I'll show you. Or if you are running a docker image loaded from rocker (or somewhere else) then tell us which one.

In short the answer depends on what you are doing exactly and you have not shown us. So, you first.

Ok, Thank you again,
What am I doing ?
I am trying to explore docker/rocker/rstudio/ subject inspired by talk on RStudio Conference 2019 by Karthik Ram.

  1. I work on windows 10 with Kitematic and Docker ToolBox and Docker Quick Start Terminal.
  2. I can download (pull) rocker/rstudio image and create a container based on it.
  3. I can run this container, log into it and work with RStudio in webbrowser (Firefox) environment.
  4. I installed some packages and after that when I run "commit" command (in Docker Quick Start Terminal) - this saves my container so when I login next time I still have all my packages that I installed previously.
  5. I was wondering how to - just in case - when new version of RStudio comes up - how to install it (update it) in my container instead of downloading a latest rocker/RStudio image, creating container again, installing packages etc. etc.

Kind regards

So committing is not a super good way to capture changes. Because you have to manually go through all the steps again.

You'll be much better off in the long run if you get in the habit of building up your image from a dockerfile. If your first call in your dockerfile is, for example:

FROM rocker/rstudio-stable:devel

then your image will be built with the latest rstudio stable devel version. In order to update you just rebuild the image and the latest version is pulled. Super simple!

so the next command in your dockerfile might be to copy over a script that loads all your packages. I call mine because I load packages an install a JupyterLab kernel (which you probably don't need). So this copies over files and then changes permissions on the script and runs it:

ADD /usr/local/bin/
RUN chmod +x /usr/local/bin/ && \ 

The contents of my are as follows:


      repos='' )
       repos='' )
       repos='' )

IRkernel::installspec(user = FALSE)

You won't need most of that junk because most of it is already installed on your image from rocker. I do it in chunks for testing and making it easy to comment out bits as needed. It could all be one big command.

I hope this helps!


Thank you very much indeed, I will read your reply carefully and try to learn from it with understanding of these individual steps and commands (I am a beginner).
I am very grateful.

you are very welcome. I hope it helps. Feel free to come back and ask more questions as you get hung up! It can be very tricky to get started.

Thanks again, that was a pleasure to watch your talk at RStudio Conference 2019, great stuff and very inspiring as well.

1 Like

Where should I place a Dockerfile ?

anywhere you want. I typically put it in the root directory of my project I'm working on.

1 Like

On windows 10 Home I think it may be a bit different.
I use Docker Toolbox that uses (in the background) VirtualBox to manage images and containers. I do not have root directory accessible directly as everything is inside disk.vmdk file. I can't get inside this vmdk file to get to the root directory. I hope I did not confuse anything. Apologies if I did.

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.