Problem dockerizing a R Shiny application with the package ggvis

64 Views Asked by At

I have some trouble dockerizing a Shiny app. The problem comes from the dockerization of the package ggvis. Here is a minimal example.

The shiny app:

library(shiny)
library(ggvis)

df<-iris

ui <- fluidPage(
  textOutput("size"),
  br(),
  ggvisOutput("cloudPoint"),
)

server <- function(input, output, session) {
  
  output$size <- renderText({
    nrow(df)
  })
  
  output$cloudPoint <- reactive({
      df %>%
      ggvis::ggvis(~Sepal.Length,~Sepal.Width)%>%
      bind_shiny("cloudPoint")
  })
  
}

shinyApp(ui, server)

When I run it, I get the following app with the ggvis visualisation and a textOutput of the number of rows of the dataframe (150):

enter image description here

Here is the dockerfile:

FROM rocker/shiny-verse

RUN R -e "install.packages(c('ggvis'))"

COPY /shinyapp/ /srv/shiny-server/

Now, when I dockerize it and open the container in my browser I get the following application without the textOutput 150:

enter image description here

Do you have any idea about the problem ? Thank you very much for your help !

1

There are 1 best solutions below

0
SunRicq On

I have found a solution by changing the parent image in the first line of the Dockerfile FROM rocker/shiny-verse by FROM rocker/shiny:4.0.5.

Remark that with the parent image FROM rocker/shiny:latest it doesn't work.