Use Rstudio-Connect inside Docker

Hi,

I am looking for guidelines on how to use Rstudio-connect inside Docker.
I have met many issues and now, I am relying on this post of SO :

This is very dirty code but it works in some way.

  • Is there better way of doing it?

My Dockerfile right now:

FROM ubuntu

RUN apt-get update
RUN apt-get install -y gdebi-core
RUN apt-get install -y build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev
RUN apt-get install -y r-base
RUN apt-get autoclean
RUN apt-get clean
RUN apt-get install -y texlive-full
RUN apt-get install -y libgmp10-dev libgsl0-dev libnetcdf-dev   netcdf-bin  libdigest-hmac-perl  libgmp-dev   libgmp3-dev  libgl1-mesa-dev   libglu1
RUN apt-get install -y  net-tools
RUN apt-get install -y procps
RUN apt-get install -y rrdtool

WORKDIR /root

# Install rstudio connect
COPY rstudio-connect_*.deb rstudio.deb

RUN gdebi -n rstudio.deb
# https://stackoverflow.com/questions/45918838/running-rstudio-connect-using-docker

RUN systemctl enable rstudio-connect.service
RUN cp /opt/rstudio-connect/packaging/init/upstart/rstudio-connect.conf /etc/init/rstudio-connect.conf

EXPOSE 3939

Run command:

docker run -it  -p 3939:3939 --privileged --rm --name something imagename

And when it runs:

/opt/rstudio-connect/bin/connect --config /etc/rstudio-connect/rstudio-connect.gcfg

Related post on this forum:

Kind regards,
Michaƫl

What is the output when you build the container? Is your dockerfile using a CI system, because that would be very helpful to see what changes are good vs bad, and very helpful. I would try to put your dockerfile into a folder with your scripts, and build the image via: cd ing into where the folder is, and then trying to docker build . , and seeing if it succeeds or not. Can you connect via localhost:8080? I would try to build your container first using the rocker images, and then try building with RStudio Connect. If you are looking for a good walkthrough of using docker, I wrote up a blog on creating containers with R: https://medium.com/@peterjgensler/creating-sandbox-environments-for-r-with-docker-def54e3491a3

Thanks for your answer, after a call with Rstudio engineers we understood that it was more complicated than expected to put Rstudio connect inside docker.
Here are 2 resources which have been usefull:


Right now, with these resources, we have been able to build the image, but we can't deploy during the build (that was the initial use case).