Geschreven door James Twose

How to deploy an R Shiny webapp with Docker on Render

Data1 minuut leestijd

Lately, a lot of people have been asking me about how to deploy web apps using Docker, Inc for their hobby projects. So to help people I threw this quick tutorial about how to deploy an R Shiny web app on Render using their free tier.

Video tutorial

In this tutorial, we are creating a simple R Shiny web app, running it locally, hosting it locally via Docker (desktop), and deploying via Docker and render.com. Sounds fun, right? Let's have a look!

Running (locally)

  • Clone this repo
    git clone git@github.com:jameshtwose/rshiny-docker-render.git
  • Run the app
    Rscript app.R
  • Open the app in your browser
    http://localhost:5000

Running (Docker/ local)

  • Build the Docker image
    docker build -t rshiny-docker-render .
  • Run the Docker image
    docker run -d -p 5000:5000 rshiny-docker-render
  • Open the app in your browser
    http://localhost:5000

Deploying (render.com)

  • Create a new web service
  • Select "Docker" as the environment
  • Select "GitHub" as the deployment method
  • Select this repo
  • Deploy the app

The GitHub repo can be found here: https://github.com/jameshtwose/rshiny-docker-render
And the live demo can be found here: https://rshiny-docker-render.onrender.com/