Installing packages for Rstudio Docker

I’m trying to use Rstudio on a DigitalOcean server using the Rstudio docker. Since my experience with linux servers is limited, it’s been a bit of a challenge for me.

I’m able to get Rstudio up and running with:

  • Different development environments with docker
  • Boot2docker VM graphics
  • Cannot start docker container from scratch
  • Why can't I extend docker postgres image to create extra database and user
  • Can't connect to Redis/Memcache from inside Docker Container
  • Appending to base image's ENTRYPOINT
  • docker run -dp 8787:8787 -v /root:/home/rstudio/ -e ROOT=TRUE rocker/hadleyverse
    

    However, I’d like to be able to shut down the server and save it to a snapshot when I’m not using it, but not have to re-install packages each time I do so.

    Using the the docker documentation on updating an image, I am able to create a container, install packages on that container, and then commit the changes:

    docker run -t -i rocker/hadleyverse /bin/bash
    install.r randomForest
    exit
    docker commit \<CONTAINER_ID> michael91/ms:v1
    

    However, once I make the commit, I am unable to run the updated image properly. I try and run it as follows:

    docker run -dp 8787:8787 -v /root:/home/rstudio/ -e ROOT=TRUE michael91/ms:v1
    

    When I do so, Rstudio server is not activated, as it is when I run the original rocker/hadleyverse version. I’ve tried making commits with and without installing packages; either way it doesn’t seem to work. Obviously I’m doing something incorrectly, but I’m not sure what. If anyone could offer me some guidance, I’d really appreciate it.

    Edit: Thanks a lot VonC; that did the trick.

  • Providing a stable url to access a docker container from another docker container
  • docker build failing with Could not resolve 'archive.ubuntu.com'
  • how to load dump on docker mysql container based on centos6?
  • tar command not found in Dockerfile
  • ASP core HttpClient.Get From container to localhost site is failing
  • NodeJS + Forever + Docker configuration doesn't work
  • One Solution collect form web for “Installing packages for Rstudio Docker”

    It could be because the new committed image has lost its CMD directive that was present in rocker-org/rocker/rstudio/Dockerfile#L58.

    CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d /supervisord.conf"]
    

    Try and create a new Dockerfile:

    FROM michael91/ms:v1
    ## Add RStudio binaries to PATH
    ENV PATH /usr/lib/rstudio-server/bin/:$PATH 
    ENV LANG en_US.UTF-8
    EXPOSE 8787
    
    CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
    

    And build it as michael91/ms:v2.

    Then see v2 works better than v1 when it comes to activating RStudio:

    docker run -dp 8787:8787 -v /root:/home/rstudio/ -e ROOT=TRUE michael91/ms:v2
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.