Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Rstudio-connect using docker

Tags:

I try ton install Rstudio-connect using Docker. I tried to use ubuntu, centos and rocker/tidyverse base image. without success...

This is the Dockerfile I make.

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 gdebi -n rstudio-connect.deb
COPY rstudio-connect-*-amd64.deb rstudio-connect.deb
EXPOSE 3939

With this container I can't run rstudio connect. I have this error : "No known init system detected." from ths script /var/lib/dpkg/info/rstudio-connect.postinst Anyway I try to launch by hand

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

But I have this error :

> root@f5a1b89e68f2:/# systemctl enable rstudio-connect.service Created
symlink
> /etc/systemd/system/multi-user.target.wants/rstudio-connect.service,
pointing to /lib/systemd/system/rstudio-connect.service.
> root@f5a1b89e68f2:/# systemctl start rstudio-connect.service Failed to
connect to bus: No such file or directory

If I directly run ./connect

This Is waht I obtain :

> root@f5a1b89e68f2:/opt/rstudio-connect/bin# ./connect --config /etc/rstudio-connect/rstudio-connect.gcfg
2017/08/28 12:14:14 Resource limits: {"nofile":{"soft":1048576,"hard":1048576}}
2017/08/28 12:14:14 Starting RStudio Connect v1.5.4-13
2017/08/28 12:14:14 Loading server configuration from /etc/rstudio-connect/rstudio-connect.gcfg
2017/08/28 12:14:14 Creating data directory: /var/lib/rstudio-connect
2017/08/28 12:14:14 Creating database directory: /var/lib/rstudio-connect/db
2017/08/28 12:14:14 Creating metrics directory: /var/lib/rstudio-connect/metrics/rrd
2017/08/28 12:14:14 Creating applications directory: /var/lib/rstudio-connect/apps
2017/08/28 12:14:14 Creating application bookmarks directory: /var/lib/rstudio-connect/bookmarks
2017/08/28 12:14:14 Creating document output directory: /var/lib/rstudio-connect/reports
2017/08/28 12:14:14 Creating document customization directory: /var/lib/rstudio-connect/overrides
2017/08/28 12:14:14 Creating manual document customization directory: /var/lib/rstudio-connect/overrides/manual
2017/08/28 12:14:14 Creating document variant customizations directory: /var/lib/rstudio-connect/overrides/variant
2017/08/28 12:14:14 Creating R library directory: /var/lib/rstudio-connect/R
2017/08/28 12:14:14 Checking ownership and permissions for the R library directory: /var/lib/rstudio-connect/R
2017/08/28 12:14:14 Creating Packrat cache directory: /var/lib/rstudio-connect/packrat
2017/08/28 12:14:14 Checking ownership and permissions for the Packrat cache directory: /var/lib/rstudio-connect/packrat
2017/08/28 12:14:14 Creating jobs directory: /var/lib/rstudio-connect/jobs
2017/08/28 12:14:14 Creating jobs-spool directory: /var/lib/rstudio-connect/jobs-spool
2017/08/28 12:14:14 Creating bundle directory: /var/lib/rstudio-connect/bundles
2017/08/28 12:14:14 Creating base bind mount directory: /opt/rstudio-connect/mnt
2017/08/28 12:14:14 Creating application bind mount directory: /opt/rstudio-connect/mnt/app
2017/08/28 12:14:14 Creating application bookmarks bind mount directory: /opt/rstudio-connect/mnt/bookmarks
2017/08/28 12:14:14 Creating document output bind mount directory: /opt/rstudio-connect/mnt/report
2017/08/28 12:14:14 Creating R library bind mount directory: /opt/rstudio-connect/mnt/R
2017/08/28 12:14:14 Creating packrat bind mount directory: /opt/rstudio-connect/mnt/packrat
2017/08/28 12:14:14 Creating source package bind mount directory: /opt/rstudio-connect/mnt/source-packages
2017/08/28 12:14:14 Creating empty bind mount directory: /opt/rstudio-connect/mnt/empty
2017/08/28 12:14:14 Using HTTP access log: /var/log/rstudio-connect.access.log
2017/08/28 12:14:14 Starting licensing...
2017/08/28 12:14:15 Could not detect R at /usr/lib/R/bin/R: Could not run R as rstudio-connect; exit status 1; received output: '28 Aug 2017 12:14:15 [rsandbox] ERROR system error 1 (Operation not permitted); OCCURRED AT: int main(int, char* const*) /home/ubuntu/rstudio-pro/src/cpp/server/sandbox/SandboxMain.cpp:136; LOGGED FROM: int main(int, char* const*) /home/ubuntu/rstudio-pro/src/cpp/server/sandbox/SandboxMain.cpp:137
'
2017/08/28 12:14:15 Could not detect R at /usr/bin/R: Could not run R as rstudio-connect; exit status 1; received output: '28 Aug 2017 12:14:15 [rsandbox] ERROR system error 1 (Operation not permitted); OCCURRED AT: int main(int, char* const*) /home/ubuntu/rstudio-pro/src/cpp/server/sandbox/SandboxMain.cpp:136; LOGGED FROM: int main(int, char* const*) /home/ubuntu/rstudio-pro/src/cpp/server/sandbox/SandboxMain.cpp:137
'
2017/08/28 12:14:15 Error: Unable to use R on this system: Could not locate an R installation

But R Is present, and rstudio-connect user can run it!

any idea ?

Regards

like image 711
Vincent Guyader Avatar asked Aug 28 '17 12:08

Vincent Guyader


1 Answers

Connect uses a sandbox that uses the same mechanisms as Docker to hide certain directories from executable user code. You'll need to run the container in "privileged" mode. Try doing docker run --privileged ...

like image 162
Jeff Allen Avatar answered Oct 11 '22 14:10

Jeff Allen