Skip to content
Use R, Rstudio, Shiny, Radiant, Python, and Jupyter in a Docker container
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
install rsm-msba-spark Apr 20, 2019
postgres postgres from radiant Mar 2, 2019
r-bionic nvim Apr 13, 2019
radiant
readings Update to R and Python cleanup steps Dec 29, 2018
rsm-dev
rsm-editors
rsm-extend rsm-dev Mar 27, 2019
rsm-jupyterhub revert to 0.9.4 Apr 17, 2019
rsm-msba-beakerx
rsm-msba-spark
rsm-msba bootstrap Apr 20, 2019
rsm-postgres
ssh
ubuntu 1.0.0 Dec 10, 2018
.gitignore
README.md update version argument during build Jan 5, 2019
build-containers.sh
dclean.sh
docker.Rproj Dockerized Business Analytics Jun 2, 2018
launch-r-bionic.sh args + quote + bash + mnt Apr 11, 2019
launch-radiant.sh args + quote + bash + mnt Apr 11, 2019
launch-rsm-dev.sh args + quote + bash + mnt Apr 11, 2019
launch-rsm-editors.sh
launch-rsm-jupyterhub.sh
launch-rsm-msba-beakerx.sh base directory Apr 6, 2019
launch-rsm-msba-spark.sh
launch-rsm-msba.sh
pull-containers.sh

README.md

Dockerized Business Analytics

This repo contains information to setup a dockerized instance with R, Rstudio, Shiny, Radiant, Python, and JupyterLab

Install Docker

To use the docker images you first need to install Docker

After installing Docker, check that it is running by typing docker --version in a terminal. This should return something like the below:

docker --version
Docker version 18.09.0, build 4d60db4

The full rsm-msba setup uses Docker Compose so also check this is available by typing docker-compose --version in a terminal. This should return something like the below:

docker-compose --version
docker-compose version 1.21.1, build 5a3f1a3

On windows please install Git Bash:

http://www.techoism.com/how-to-install-git-bash-on-windows/

For detailed install instructions on Windows see install/rsm-msba-windows.md

For detailed install instructions on macOS see install/rsm-msba-macos.md

TL;DR

To jump straight in and run the main application run the command below on macOS:

docker run --rm -p 8080:80 -p 8787:8787 -p 8989:8888 -v ~:/home/rstudio vnijs/rsm-msba

For Windows run the command below:

docker run --rm -p 8080:80 -p 8787:8787 -p 8989:8888 -v c:/Users/$USERNAME:/home/rstudio vnijs/rsm-msba

Perhaps even easier, you can start the rsm-msba container on macOS using launch-mac.command and on Windows using launch-windows.sh. To get these files download the repo https://github.com/radiant-rstats/docker or clone the repo using git clone https://github.com/radiant-rstats/docker.git is you have git installed. To run the script on Windows you will need Git Bash installed as referenced above.

Another alternative approach is to use docker-compose and the command below after cloning the repo:

docker-compose -f ./rsm-msba/docker-rsm-msba.yml up

Note: For Windows you may need to change the path in the volumes: section to c:/Users/$USERNAME

For more information about running the radiant application see radiant/README.md

For more information about running the rsm-msba application see rsm-msba/README.md

r-bionic

You probably don't want to run this image by itself. It is used in the radiant and rsm-msba application (see below). To build a new container based on r-bionic add the following at the top of your Dockerfile

FROM vnijs:docker-bionic

To build r-bionic yourself use:

docker build -t $USER/r-bionic ./r-bionic

Push to docker hub:

sudo docker login 
docker push $USER/r-bionic

radiant

The second image builds on r-bionic and adds radiant and required R-packages. To build a new container based on radiant add the following at the top of your Dockerfile

FROM vnijs:radiant

To build radiant yourself use:

docker build -t $USER/radiant ./radiant

Push to docker hub:

sudo docker login 
docker push $USER/radiant

Add the following to .Rprofile in your home directory

options(radiant.ace_vim.keys = FALSE)
options(radiant.maxRequestSize = -1)
# options(radiant.maxRequestSize = 10 * 1024^2)
options(radiant.report = TRUE)
# options(radiant.ace_theme = "cobalt")
options(radiant.ace_theme = "tomorrow")
# options(radiant.ace_showInvisibles = TRUE)

rsm-msba

The third image builds on the radiant image and adds python and Jupyter. To build a new container based on rsm-msba add the following at the top of your Dockerfile

FROM vnijs:rsm-msba

To build rsm-msba yourself use:

docker build -t $USER/rsm-msba ./rsm-msba

Push to docker hub:

sudo docker login 
docker push $USER/rsm-msba

The rsm-msba directory also contains a docker-compose file that pulls in a postgres image and database admin tool adminer. To run the full application use the command below.

docker-compose -f ./rsm-msba/docker-rsm-msba.yml up

Installing R-packages

If you want to install an R-package, e.g., fortune, in a way that persists when using the container again, use the command below. This will install the package and create a personal directory for future package installs. You will only need to add the lib = Sys.getenv("R_LIBS_USER") argument once to generate the personal directory.

install.packages("fortunes", lib = Sys.getenv("R_LIBS_USER"))

Installing Python packages

If you want to install a python package, e.g., redis, in a way that persists when using the container again, use the command below from the Jupyter (or Rstudio) terminal. This will install the package and create a personal directory for future package installs.

pip3 install -U "redis"

Trouble shooting

To stop (all) running containers use:

docker kill $(docker ps -q)

If the build fails for some reason you can access the container through the bash shell using to investigate what went wrong:

docker run -t -i $USER/rsm-msba /bin/bash

To remove an existing image use:

docker rmi --force $USER/rsm-msba

To remove stop all running containers, remove unused images, and errand docker processes use the dclean.sh script

./dclean.sh

General docker related commands

Check the disk space used by docker images

docker ps -s
docker system df

On mac you can use the commands below to push your custom image to docker hub:

sudo docker login 
docker push $USER/rsm-msba

Add the following to .Rprofile in your home directory

options(radiant.ace_vim.keys = FALSE)
options(radiant.maxRequestSize = -1)
# options(radiant.maxRequestSize = 10 * 1024^2)
options(radiant.report = TRUE)
# options(radiant.ace_theme = "cobalt")
options(radiant.ace_theme = "tomorrow")
# options(radiant.ace_showInvisibles = TRUE)

Trademarks

Shiny and Shiny Server are registered trademarks of RStudio, Inc. The use of the trademarked terms Shiny and Shiny Server and the distribution of the Shiny Server through the images hosted on hub.docker.com has been granted by explicit permission of RStudio. Please review RStudio's trademark use policy and address inquiries about further distribution or other questions to permissions@rstudio.com.

Jupyter is distributed under the BSD 3-Clause license (Copyright (c) 2017, Project Jupyter Contributors)

Acknowledgements

Thanks to Ajar Vashisth for helping me get started with Docker and Docker Compose

You can’t perform that action at this time.