Introduction

The goal of this sevenbridges/sevenbridges-r Docker image is to provide

Docker container

Build container locally

The Dockerfile is included with the package in inst/docker folder.

Here is the current content of Dockerfile:

fl <- system.file("docker/sevenbridges/", "Dockerfile", package = "sevenbridges")
cat(readLines(fl), sep = "\n")

You can simply build it locally, enter folder which contain that Dockerfile, in this case, it is under inst/docker/sevenbridges

docker build -t sevenbridges/sevenbridges-r .

Pull from Docker Hub

A hook is added to build the Docker image automatically from the sevenbridges-r GitHub repository. It is automatically built on Docker Hub. You can directly use this image sevenbridges/sevenbridges-r. Everytime a push is made in the GitHub repo, the Docker container is re-built.

Launch RStudio Server from Docker container

For example, you can ssh into your AWS instance, here I suppose you already have Docker installed, and pull the image

docker pull sevenbridges/sevenbridges-r

To launch sevenbridges RStudio Server image, I recommend you read this tutorial

Or following the quick instruction here

docker run -d -p 8787:8787 sevenbridges/sevenbridges-r
docker run -d -p 8787:8787 -e USER=<username> -e PASSWORD=<password> rocker/rstudio

You will be able to access the RStudio in the browser by something like

http://<your_ip_address>:8787

Sometimes you want to add more users, to add users

## Enter the container
docker exec -it <container-id> bash
## Interactively input password and everything else
adduser <username>

Launch both RStudio Server and Shiny Server from the same Docker container

Sometimes it is very conventient to launch both RStudio Server and Shiny Server from a singel container and your users can manage to using RStudio Server and publish Shiny apps at the same time in the same container. To do so, just pull the same image and launch them at different port.

docker run  -d -p 8787:8787 -p 3838:3838 --name rstudio_shiny_server sevenbridges/sevenbridges-r

To mount file system you need to use --privileged with fuse.

docker run  --privileged -d -p 8787:8787 -p 3838:3838 --name rstudio_shiny_server sevenbridges/sevenbridges-r

check out the ip from docker machine if you are on mac os.

docker-machine ip default

In your browser, http://<url>:8787/ for RStudio Server, for example, if 192.168.99.100 is what returned, visit http://192.168.99.100:8787/ for RStudio Server.

For Shiny Server, per user app is hosted http://<url>:3838/users/<username of rstudio>/<app_dir>, for example, for user rstudio (a default user) and an app called 01_hello, it will be http://<url>:3838/users/rstudio/01_hello/. To develop your Shiny app from RStudio Server, you can log into your RStudio Server with your username, and create a fold at home folder called ~/ShinyApps and develop Shiny apps under that folder, for example, you can create an app called 02_text at ~/ShinyApps/02_text/.

Let's try this, please log into your RStudio at http://<url>:8787 now, then try to copy some example over to your home folder under ~/ShinyApps/

dir.create("~/ShinyApps")
file.copy(
  "/usr/local/lib/R/site-library/shiny/examples/01_hello/",
  "~/ShinyApps/", recursive = TRUE
)

If you logged in with the username rstudio, then visit http://192.168.99.100:3838/rstudio/01_hello you should be able to see the hello example.

Note: Generic Shiny apps can also be hosted http://<url>:3838/ or for particular app, http://<url>:3838/<app_dir> and inside the Docker container, it is hosted under /srv/shiny-server/.



sbg/sevenbridges-r documentation built on March 26, 2021, 3:33 p.m.