Running RStudio via Docker in the Cloud

12 comments
Deploying applications via Docker container is the current talk of town. I have heard about Docker and played around with it a little, but when Dirk Eddelbuettel posted his R and Docker talk last Friday I got really excited and had to have a go myself.

My aim was to rent some resources in the cloud, pull an RStudio Server container and run RStudio in a browser. It was actually surprisingly simple to get started.

I chose Digital Ocean as my cloud provider. They have many Linux systems to choose from and also a pre-built Docker system.


After about a minute I had kicked off the Docker droplet I could log into the system in a browser window and start pulling the Docker file, e.g. Dirk's container.


Once the downloads finished I could start the RStudio Server using the docker run command and log into a RStudio session. To my surprise even my googleVis package worked out of the box. The plot command opened just another browser window to display the chart; here the output of the WorldBank demo.


All of this was done within minutes in a browser window. I didn't even use a terminal window. So, that's how you run R on an iPad. Considering that the cost for the server was $0.015 per hour, I wonder why I should buy my own server, or indeed buy a new computer.

12 comments :

  1. Hi mages,

    Does the estimated cost include storage of data? This solution looks to be cheaper than Amazon EC?

    ReplyDelete
  2. The cost is for a server with 30GB SSD and 2TB transfer.

    ReplyDelete
  3. Great post, thanks for sharing your experience!

    ReplyDelete
  4. There is a discussion about using rstudio + docker for reproducible research ongoing here: https://groups.google.com/forum/m/#!topic/ropensci-discuss/QogAhS-tajQ

    ReplyDelete
  5. This is awesome. The iPad comment: Unless something has changed recently I don't think using RStudio from a browser works with a mobile browser. I think it has to do with the ace editor.

    ReplyDelete
  6. Thanks for the great idea! At the risk of this being obvious, could you let me know the specific docker command to run rstudio? Is it just run docker ... rstudio-server start? Do you have to configure it so that it is accessible on a public IP address?

    ReplyDelete
  7. I only experimented a little with this on my iPad, but it seemed to work.

    ReplyDelete
  8. The discussion pointed out by Carsten below has a lot more of the details.

    ReplyDelete
  9. Glad you've had a chance to have a go with docker Markus! Sounds like it was useful.

    I'd be interested to see another post if you decide to take it any further.

    ReplyDelete
  10. Thanks to you as well and your great talk at EARL!

    ReplyDelete
  11. Michael Crawford13 January 2015 at 15:37

    Hi Markus - have something similar using Vagrant & EC2. We built an machine image as standard set-up for data analysis that has Git, R, RStudio, Shiny server, Anaconda python & IPython notebooks. Its a great way to quickly beef up processing power on the fly and makes deploying demos to clients a breeze.

    ReplyDelete
  12. Brilliant! It is really astonishing what one can achieve nowadays with the could infrastructure. It has really speeded up prototyping.
    Getting feedback faster from clients makes all the differences in ensuring resources are well spend.

    ReplyDelete