Dockerfile for shiny app not working

I would like to run a shiny application in the cloud. When I am pulling the shiny-verse image without anything in the Dockerfile, the shiny-server default starter app runs. However, when I am building a Dockerfile like this:

FROM rocker/shiny-verse:latest

COPY . /srv/shiny-server/

# expose port
EXPOSE 3838

# run app
# CMD ["/usr/bin/shiny-server"]

Then nothing gets displayed and I am getting a 404 error. uncommenting the last line was not successful either.

My folder structure:


project.Rproj
new_folder/
    ├─ app.R
Dockerfile

My shiny app is the default app

#
# This is a Shiny web application. You can run the application by clicking
# the 'Run App' button above.
#
# Find out more about building applications with Shiny here:
#
#    http://shiny.rstudio.com/
#

library(shiny)

# Define UI for application that draws a histogram
ui <- fluidPage(

    # Application title
    titlePanel("Old Faithful Geyser Data"),

    # Sidebar with a slider input for number of bins 
    sidebarLayout(
        sidebarPanel(
            sliderInput("bins",
                        "Number of bins:",
                        min = 1,
                        max = 50,
                        value = 30)
        ),

        # Show a plot of the generated distribution
        mainPanel(
           plotOutput("distPlot")
        )
    )
)

# Define server logic required to draw a histogram
server <- function(input, output) {

    output$distPlot <- renderPlot({
        # generate bins based on input$bins from ui.R
        x    <- faithful[, 2]
        bins <- seq(min(x), max(x), length.out = input$bins + 1)

        # draw the histogram with the specified number of bins
        hist(x, breaks = bins, col = 'darkgray', border = 'white')
    })
}

# Run the application 
shinyApp(ui = ui, server = server)

When I run docker locally, http://[::]:3838 displays the default starter app and http://[::]:3838/docker_test/ displays the old geyser app. However, this is not working on a remote server.

However, only having

FROM rocker/shiny-verse:latest

in the Dockerfile works fine and displays he shiny server starter default app. Any help will be appreciated. Thank you.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.