flowchart TD A[Shiny app] --> B[Docker container] B --> C[Cloud Run service] C --> D[Public URL] C --> E[Logs and revisions] C --> F[Scaling]
useR! 2026 Conference
Vilnius University
2026-07-08
Google Cloud Run is a managed service for running containerized (e.g. Docker) applications without having to manage a server.
It handles the infrastructure around the app but lets us define the app, packages, container, memory, CPU, and access settings.
flowchart TD A[Shiny app] --> B[Docker container] B --> C[Cloud Run service] C --> D[Public URL] C --> E[Logs and revisions] C --> F[Scaling]
Project: the workspace where Google Cloud resources live.
Console: the browser interface for managing Google Cloud.
Cloud Run: the service that runs our Shiny app as a containerized web app.
Cloud Build and Artifact Registry: the services that build and store the container image before Cloud Run runs it.
Checklist:
app.R and DockerfileWorkflow:
Shiny app files → Dockerfile → Cloud Build → Artifact Registry → Cloud Run service → public URL
Docker packages an app with everything it needs to run. For Shiny:
flowchart TD A[Shiny app] --> E[Docker image] B[R packages] --> E C[System libraries] --> E D[Startup command] --> E E --> F[Container] F --> G[Running dashboard]
ShinyFROM rocker/shiny:4.4.0
USER root
RUN install2.r --error --skipinstalled --ncpus -1 \
palmerpenguins \
dplyr \
ggplot2 \
DT
WORKDIR /srv/shiny-server
COPY . /srv/shiny-server
RUN chown -R shiny:shiny /srv/shiny-server
ENV PORT=8080
EXPOSE 8080
USER shiny
CMD ["R", "-e", "shiny::runApp('/srv/shiny-server', host='0.0.0.0', port=as.numeric(Sys.getenv('PORT', '8080')))"]FROM rocker/shiny:4.4.0 chooses the starting environment, here an image that already contains R and Shiny.
RUN install2.r ... installs the R packages the app needs.
WORKDIR /srv/shiny-server and COPY . /srv/shiny-server create the app folder inside the container and copy your local files into it.
ENV PORT=8080 and EXPOSE 8080 sets the port the app will use, should match the service.
CMD ["R", "-e", "..."] tells the container what to do when it starts (e.g. run the Shiny app)
Shiny on Cloud Run?Closer to production cloud workflows: Docker logic can be reused for Shiny apps, APIs, Python services, background jobs, or other web apps.
Fine-grained resource control: adjust CPU, memory, concurrency, minimum instances, and maximum instances instead of buying into a fixed publishing platform.
More flexible runtime environment: you can include system libraries, non-R tools, Python, command-line utilities, or unusual package requirements.
