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:

  • Rails docker - Bundle with custom path not able to access gems
  • Spring boot app not work on AWS
  • How can I pass arguments to a docker container with a python entry-point script using command?
  • JCoCo Code Coverage inside Docker Image
  • Will the linked docker container gets the link when it goes down and come up?
  • Deploy NoneJS application with Docker
  • 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
    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.

  • How do I configure boot2docker to start my containers on boot?
  • Docker - wordpress deployed on Digital Ocean Droplet - where is the wp-content?
  • Failure - Authentication is required to pull public docker images from Dockerhub registry
  • docker-compose file removes the files extracted by dockerfile in container directory
  • Best place to install antivirus with docker
  • Docker registry:2 won't start
  • 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.