
Quick introduction to this course
Freshly built repositories to run R-Studio and Jupiter notebook in Containers
Amazing! We just run a line of code in a terminal and getting a working R-Studio in the browser!
only Docker software is needed!
This program will work in this state
Note: more details how to install and build this container will be explained in the next chapters!
Executing R program using Docker Container
Showing ShinyApp which runs in the container + proposing a reader to pull the image and run the container to test the same App!
Introducing this chapter:
Preparation
Setting up accounts
Installing software
Create an Account on Docker Hub. This is helpful for several reasons:
We can save and keep our Container Image in the cloud repository (1 private repository is given for free)
We can share our work (note that image can also be stored persistently) if needed
Installation of Docker Desktop - Application to develop or run Docker Containers
Reviewing several settings of the Docker Desktop application:
keep it starting up on re-start or not
allocated disk memory
allocated CPU/resources
Instructions to install Docker on Linux
The best and easiest way to follow this course is to use any User Friendly Version Control Software!
My preferred one is GitHub Desktop
Goals of this section - build our personalized Docker Image with R-Studio and all our favorite packages!
Re-using Dockerfile for our new project
Put our project under version control! It really takes 5 minutes!
Starting building a Docker Image
docker login
docker build -t <docker hub user name/repository name> .
mind the dot!
While our image is being built we will update our Readme file.
Why? For a sole purpose of be able to repeat the procedure and re-build the same image some time after!
Use command docker images to list available images
Use command docker run with options to run the container
Map folders content to use them in our container
Updating readme file with an example of instructions learned so far
Creating executable file using vim editor
Saving this image in the Docker Hub [optional]
Saving image locally has it's advantages...
Image can be removed from our computer to optimize space. Good thing is that image can be easily restored either from file or from the docker hub. It is enough to run executable file and docker will check for the image presence first locally and then on Docker hub... and it will download it!
Practicing to restore image from file. Not relevant in case of:
image is stored in Docker Hub
good internet connection
no concern over publishing image
Using another terminal to fetch container ID
Change docker image can be also done after building it. For example:
adding new package
updating something on Linux machine
adding our research document, run it and saving results into the image...
Update Image on Docker Hub
Save a new version of an image. Useful to support lifecycle of the software
taking advantage of the automated builds:
adding the R package with much less effort!
Multiple advantages of automated build are including significant reduction of effort to maintain released images
A very practical example on how to use R-Studio in a Docker Container:
Map local folder to container
Create multiple project using R-Studio
Add project under version control
Summary of this section
Introduction to the section. What are the advantages to have our own image template with R installation?
Reviewing repository containing:
R script with commands to install favorite R packages
Dockerfile with commands to start building image from verified publisher 'rocker/r-base'
Use feature Autobuilds to build image directly on Dockerhub infrastructure
Recommendation to use verified publisher of the docker images to start working on your own container
docker pull vladdsm/docker-r-h2o
testing r container
Intermediate summary
Having IDE in container
Having r-base with h2o
we can update our images using Autobuilds!
Visual blueprint explaining management of docker images
Re-use dockerfile
Focus on research using Version Control, automated builds
Share results to others
visual representation of steps
Added reproducible research doc
Adding R markdown document to the image
Add R script to render this document
testing our container, results will be generated in the folder mapped to the output folder of the container
push the image to Dockerhub
Reproducing research by running container on Windows 10 machine
How to use our image to add any of our scripts and run it!
#Create a new dockerfile using
FROM vladdsm/docker-r-h2o:latest
# add our script
ADD *.RMD document
# execute the script as soon as container runs
CMD RScript run_analysis_script.R
Building and pushing the image to the Docker Hub
Testing the container... expected result is to see the output file generated in the folder
Publish our work in GitHub
In this Section we will look into specific case study aimed to demonstrate usage of Docker Containers to publish and consume data via Application Programming Interface [API].
Key features discussed:
Setup Docker Container to publish API
Setup Docker Network
Use Shiny App in another container to consume data from the API
In this Section we will look into specific case study aimed to demonstrate usage of Docker Containers to publish and consume data via Application Programming Interface [API].
Key features discussed:
Setup Docker Container to publish API
Setup Docker Network
Use Shiny App in another container to consume data from the API
Develop Plumber API code using Environment running R-Studio in the Docker container
Build docker image with Plumber API
Creating and inspecting docker network
Testing connectivity between working containers
Getting code to the toy Shiny Application
Test multi container application
Introduction to this chapter:
Goal is to place our Shiny Application into the portable Docker Image
Quick win:
Starting our first rocker shiny server
Video explanation:
Getting started with Shiny Server
Possible options:
rocker/shiny-verse
rocker/shiny
openanalytics/shinyproxy
Using Shiny Server on Docker Container to run locally stored Shiny Apps
Embedding Shiny Apps into Docker Image and then run Starting Shiny App on Shiny Server running on Docker Container ...
... in English:
Storing Shiny App into Docker Image
Running Shiny Server on Docker Container
Accessing Shiny Application from Browser
A quick introduction to {golem} package that helps to professionally deploy ShinyApp
Planned section
Develop a blueprint and working example to setup a workflow of:
Development of ShinyApp as an R Package
Testing
Build image
Deploy Container to production
Note: planned content
TDL: add links from UseR2019
Get excited!
This course is designed to jump-start using Docker Containers for Data Science and Reproducible Research by reproducing several practical examples.
Course will help to setup Docker Environment on any machine equipped with Docker Engine (Mac, Windows, Linux). Course will proceed with all steps to create custom and distributed development environment [RStudio] in a container. Forget about manual update of your Development Environment! Work as usual, add or develop the research document into your Container, test it and distribute in an image! Result will be reproducible independently on the R version, perhaps after several years...
Same about running R programs in the container. We will demonstrate this capability including testing the container on completely different machines (Mac, Windows, Linux)
Summary of ideas we will cover in this course:
Reproduce and share work on a different infrastructure
Be able to repeat the work after several years
Use R-Studio in an isolated environment
Tips to personalize work with Docker including usage of Automated Builds
What is covered by this course?
This course will provide several use cases on using Docker Containers for Data Science:
Preparing your computer for using Docker
Working pipeline to develop docker image
Building Docker image to work with R-Studio in Interactive mode
Building Docker images to run R programs
Using Docker network to communicate between containers
Building ShinyServer in Docker container
Walk-though example of developing Shiny App as an R Package and deploying in Docker Container using golem framework
More relevant materials may be added to this course in the future (e.g. continous integration and deployment, docker-compose)
Why to take this course and not other?
Added value of this course is to provide a quick overview of functionality and to provide valuable methods and templates to build on. Focus of this course is to make a learning journey as easy as possible - simply watch these videos and reuse provided code!
Just Start using Docker Containers with your Data Science tools by reproducing this course!