Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How do you install R and RStudio server on sandbox 2.5 (Docker based)

How do you install R and RStudio server on sandbox 2.5 (Docker based)

New Contributor

The story so far:

I have installed R into the docker container and It seems to run OK. I have downloaded and installed RStudio Server in the Docker container, it seems to install OK but there was a couple of error messages.

Running Transaction Installing : rstudio-server-0.99.903-1.x86_64 1/1 groupadd: group 'rstudio-server' already exists rsession: no process killed initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused Verifying : rstudio-server-0.99.903-1.x86_64 1/1

Installed: rstudio-server.x86_64 0:0.99.903-1

Complete!

Assuming that the install starts the RStudio Server (which it did in 2.4) The question is how do I access the server from outside the VM?

http://192.168.xxx.xxx:8787/ doesn't work (I'm using VMWare) neither does

http://172.17.0.2:8787/ (didn't expect this one to)

I notice that ps -ef | grep container-ip shows several lines like

/usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8088 -container-ip 172.17.0.2 -container-port 8088

but not one for port 8787 Is this this problem and If so what do I do about it?

Thanks all in advance

5 REPLIES 5

Re: How do you install R and RStudio server on sandbox 2.5 (Docker based)

Cloudera Employee

Hi @Peter Smyth

In order to have access to a particular port from outside of docker, you need to expose it at the start of the docker container.

Couple of ways to get around that:

0. First let's make sure that RStudio server is indeed up and running

  curl localhost:8787 

If you get :

curl: (7) couldn't connect to host

Then check your Rstudio server configs

1.First option - Configure Rstudio server to use a port that is already exposed.

Ex. If you're not using Zeppelin Notebooks (ie. the service is stopped), you can use port 9995

1. Go to your Rstudio server install directory and modify : rserver.conf

Change

www-port=80   to  www-port=9995 

https://support.rstudio.com/hc/en-us/articles/200552316-Configuring-the-Server

2.Restart Rstudio

3.Go to the new RStudio login page - http://localhost:9995

2. Second option - Launch a new container with the new port exposed. (a bit more work, but cleaner...)

Note by instanciating a new contained you revert to the original configurations... This need to be done on the docker host machine. In this case the VMWare virtual machine

1. login to the VM

ssh -p 2122 root@localhost 
Default password : hadoop

2. stop the current container docker stop sandbox

docker stop sandbox

3. start a new container

docker run -v hadoop:/hadoop --name sandbox2 --hostname "sandbox.hortonworks.com" --privileged -d \ -p 1000:1000 \
-p 10000:10000 \
-p 10001:10001 \
-p 10500:10500 \
-p 1100:1100 \
-p 11000:11000 \
-p 1220:1220 \
-p 15000:15000 \
-p 16010:16010 \
-p 16030:16030 \
-p 18080:18080 \
-p 1988:1988 \
-p 19888:19888 \ 
-p 10000:10000 \
-p 10001:10001 \
-p 10500:10500 \
-p 1100:1100 \
-p 11000:11000 \
-p 1220:1220 \
-p 15000:15000 \
-p 16010:16010 \
-p 16030:16030 \
-p 18080:18080 \
-p 1988:1988 \
-p 19888:19888 \ 
-p 2100:2100 \
-p 21000:21000 \
-p 2222:22 \
-p 4040:4040 \
-p 4200:4200 \
-p 42111:42111 \
-p 5007:5007 \
-p 50070:50070 \
-p 50075:50075 \
-p 50095:50095 \
-p 5011:5011 \
-p 50111:50111 \
-p 60000:60000 \
-p 6001:6001 \
-p 6003:6003 \
-p 6008:6008 \
-p 60080:60080 \
-p 6080:6080 \
-p 6188:6188 \
-p 61888:61888 \
-p 8000:8000 \
-p 8005:8005 \
-p 8020:8020 \
-p 8040:8040 \
-p 8042:8042 \
-p 8050:8050 \
-p 8080:8080 \
-p 8082:8082 \
-p 8086:8086 \
-p 8088:8088 \
-p 8090:8090 \
-p 8091:8091 \
-p 8188:8188 \
-p 8443:8443 \
-p 8744:8744 \
-p 8765:8765 \
-p 8886:8886 \
-p 8888:8888 \
-p 8889:8889 \
-p 8983:8983 \
-p 8993:8993 \
-p 9000:9000 \ 
-p 9090:9090 \
-p 9995:9995 \
-p 9996:9996 \
-p 8787:8787 \
sandbox /usr/sbin/sshd -D  

3. Add a new route to the NAT settings of the VM.

The docker container is running on a VM which is itself running on a physical host. A route must be created through both layers of virtualization to access the service. Go to (Edit > Virtual Network Settings > NAT)

Add a route for port 8787 following the same format as those already set.

4. Re - install R core and RStudio

5. go to the Rstudio Server login page

http://localhost:8787

Alternative - Use the R interpreter for zeppelin to run R code...

Re: How do you install R and RStudio server on sandbox 2.5 (Docker based)

Super Collaborator

@Matthieu Lamairesse, I am using Hortonworks Docker Sandbox and I configured rserver.conf to use one of the ports which are opened(8090 in my case). Then I restarted rstudio-server, it gave me the same error:

initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused

rsession: no process killed

Also, there was no output for netstat -nltp | grep 8090

Re: How do you install R and RStudio server on sandbox 2.5 (Docker based)

New Contributor

@Peter Smyth - Were you able to successfully install RStudio on HDP2.5 ? Are you able to view the RStudio web page at

http://localhost:9995

Re: How do you install R and RStudio server on sandbox 2.5 (Docker based)

New Contributor

HI how can I modify rserver.conf?

i am not very good at using linux system

Re: How do you install R and RStudio server on sandbox 2.5 (Docker based)

New Contributor

Let's assumed Let's assume the RStudio Server is installed correctly,

please check inside the docker by curl localhost:8787

How to go to the docker inside the sandbox?

While in sandbox terminal, login by

ssh -p 2122 root@localhost

If curl return a normal message, this is the issue of port forwarding from docker to sandbox issue

Expose the port 8787 from docker to Sandbox

Check name of docker docker ps

Check IP Address of docker image: docker inspect sandbox | grep IPAddress

IP Address Found: 172.17.0.2

Expose the port 8787 from docker to sandbox 8788

iptables -t nat -A DOCKER -p tcp --dport 8788 -j DNAT --to-destination 172.17.0.2:8787

Then check the sandbox

http://sandbox_ip_address:8788

Don't have an account?
Coming from Hortonworks? Activate your account here