Installing packages for Rstudio Docker

I am trying to use Rstudio on a DigitalOcean server using a Rockudio docker . Since my experience with Linux servers is limited, this was a problem for me.

I can start Rstudio with:

docker run -dp 8787:8787 -v /root:/home/rstudio/ -e ROOT=TRUE rocker/hadleyverse 

However, I would like to be able to disconnect the server and save it in a snapshot when I do not use it, but I do not need to reinstall the packages every time I do it.

Using the docker documentation on updating the image , I can create a container, install packages on this 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, as soon as I make a fix, I will not be able to correctly launch the updated image. I am trying to run it as follows:

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

When I do this, the Rstudio server does not activate, as it happens when I launch the original rocker / hadleverse version. I tried committing with and without installing packages; In any case, this does not work. Obviously, I'm doing something wrong, but I'm not sure what. If anyone could offer me some guidance, I would really appreciate it.

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

+5
source share
1 answer

This may be due to the fact that the new captured image lost its CMD directive, which was present in rocker-org/rocker/rstudio/Dockerfile#L58 .

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

Try creating a new Docker file:

 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 like 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 
+3
source

All Articles