Deploy shiny app in rocker/shiny docker Deploy shiny app in rocker/shiny docker docker docker

Deploy shiny app in rocker/shiny docker


I guess you should start by creating a Dockerfile in a specific folder which would look like something like this :

FROM rocker/shiny:latestRUN  echo 'install.packages(c("package1","package2", ...), \repos="http://cran.us.r-project.org", \dependencies=TRUE)' > /tmp/packages.R \  && Rscript /tmp/packages.REXPOSE 3838CMD ["/usr/bin/shiny-server.sh"]

Then go into this folder and build your image, giving it a name by using this command :

docker build -t your-tag .

Finally, once your image is built you can create a container, and if you don't forget to map the volume and the port, you should be able to find it at localhost:3838 with the following command launched from the folder containing the srv folder :

docker run --rm -p 3838:3838 -v $PWD/srv/shinyapps/:/srv/shiny-server/ -v $PWD/srv/shinylog/:/var/log/shiny-server/ your-tag

As said in the Docker documentation at the following address https://hub.docker.com/r/rocker/shiny/, you might want to launch it in detached mode with -d option and map it with your host's port 80 for a real deployment.


The link(https://hub.docker.com/r/rocker/shiny/) covers how to deploy the shiny server. Simplest way would be:docker run --rm -p 3838:3838 rocker/shiny

If you want to extend shiny server, you can write your own Dockerfile and start with shiny image as base image.(https://docs.docker.com/engine/reference/builder/)

Dockerfile:FROM rocker/shiny:latest