R Shiny at IQSS
  • Introduction
  • Getting started
    • Determining your resource requirements
    • Applying for an account
  • Deploying
    • Setup your environment
    • Deploying an example Shiny app
    • Bootstrapping a new Shiny app or migrating a pre-existing Shiny application
    • Developing locally with RStudio
    • Developing locally using Docker
    • Speeding up deployments with Packrat
  • Configuration
    • Setting up a custom domain for your Shiny app
    • Installing additional system-level packages
    • Limiting the number of R Threads
  • Best Practices
    • File storage
    • Using promises
    • Adding routes
  • Troubleshooting
    • Resolving Application Error screen
    • Viewing app logs
    • Viewing resource consumption
    • Configuring Shiny session auto-reconnect
    • Getting support
Powered by GitBook
On this page
  • Building your application docker image
  • Running your application docker image
  • Viewing in the browser
  1. Deploying

Developing locally using Docker

PreviousDeveloping locally with RStudioNextSpeeding up deployments with Packrat

Last updated 5 years ago

Using Docker to run your R Shiny app locally will produce a running instance of your application which mirrors Heroku 1:1. While testing your application within RStudio should work in most cases, running your application with Docker can provide additional verification for any code changes you've made.

Haven't yet installed Docker? Read before continuing.

All the following exercises use as the example application. To test your own application, substitute heroku-docker-r-example-app with your own application checkout or directory.

Building your application docker image

The following command will compile your application into a docker image tagged with the name my-local-heroku-docker-r-example-app. You will see the same build output as you would if you pushed your code to the git Heroku remote.

cd heroku-docker-r-example-app
docker build -t my-local-heroku-docker-r-example-app .

Running your application docker image

Once completed, you can run the docker image you produced:

docker run -p 8080:8080 -e PORT=8080 my-local-heroku-docker-r-example-app:latest

This will run your Shiny application on port 8080. You may need to click Allow on any security-related popups, common to Windows and Mac OS X, which ask whether you want to allow Docker to bind to port 8080.

If you're already using port 8080 or want to use a different port, substitute 8080 throughout the entire command with a different port number, except for ports 12000 to 13000 which are reserved for R threads within the container.

docker run -p 11000:11000 -e PORT=11000 my-local-heroku-docker-r-example-app:latest

Viewing in the browser

Go to and you should see your application.

Setup your environment
heroku-docker-r-example-app
http://localhost:8080