Hi Team,
I am new to docker and Shiny proxy and exploring this library to incorporate in my work to deploy my shiny application using dockers. As part of a proof of concept work, I accomplished following so far -
Manged to run Shiny proxy demo applications in my local
Created my custom sample application after taking inspiration from the shinyproxy-template
Dockerized my application and able to successfully run on my development machine.
As a next step I am trying to run stand-alone shiny proxy with the docker daemon, but kind of stuck and not able to progress much because of “container didn’t respond in time” error coming while launching my custom app.
My code directory structure:
–ShinySample
– application.yml
– Dockerfile
– shinysample/
– app.R
My code in app.R :
library(shiny)
Define UI ----
ui ← fluidPage(
App title ----
titlePanel(“My sample shiny App!”),
Sidebar layout with input and output definitions ----
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Input: Slider for the number of bins ----
sliderInput(inputId = "bins",
label = "Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Main panel for displaying outputs ----
mainPanel(
# Output: Histogram ----
plotOutput(outputId = "distPlot")
)
)
)
Define server logic ----
server ← function(input, output) {
Histogram of the Old Faithful Geyser Data ----
with requested number of bins
This expression that generates a histogram is wrapped in a call
to renderPlot to indicate that:
1. It is “reactive” and therefore should be automatically
re-executed when inputs (input$bins) change
2. Its output type is a plot
output$distPlot ← renderPlot({
x <- faithful$waiting
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = "#75AADB", border = "white",
xlab = "Waiting time to next eruption (in mins)",
main = "Histogram of waiting times")
})
}
#options(shiny.autoreload = TRUE)
options(shiny.host = ‘127.0.0.1’)
options(shiny.port = 3838)
Run the app ----
shinyApp(ui = ui, server = server)
Docker file :
FROM rocker/shiny:3.5.3
fetching from CRAN repo
RUN R -e “install.packages(c(‘shiny’), repos=‘*****’)”
copy the app to the image
RUN mkdir /root/shinysample
COPY shinysample /root/shinysample
EXPOSE 3838
CMD [“R”, “-e”, “shiny::runApp(‘/root/shinysample’, host=‘0.0.0.0’, port=3838)”]
YAML file :
proxy:
title: My sample shiny app from Shinyproxy
landing-page: /
port: 8080
# Docker configuration
docker:
# cert-path: /home/none
url: http://localhost:2375
# port-range-start: 20000
specs:
- id: shinysample
display-name: Shiny sample app running on container via shinyproxy
description: Shiny sample app running on container via shinyproxy
container-cmd: [“R”, “-e”, “shiny::runApp(‘/root/shinysample’)”]
container-image: asarolia/shinysample03
#access-groups: scientists
logging:
file:
shinyproxy.log
I am successfully able to run image using docker -
docker run -it -p 3838:3838 asarolia/shinysample04
but when running using shinyproxy getting error "container didn’t respond in time ". Tried to run shinyproxy via command line but that is failing with below error -
docker run -p 3838:3838 openanalytics/shinyproxy-demo R -e shiny::runApp(‘/root/shinysample’)
R version 3.5.2 (2018-12-20) – “Eggshell Igloo”
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type ‘license()’ or ‘licence()’ for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type ‘contributors()’ for more information and
‘citation()’ on how to cite R or R packages in publications.
Type ‘demo()’ for some demos, ‘help()’ for on-line help, or
‘help.start()’ for an HTML browser interface to help.
Type ‘q()’ to quit R.
shiny::runApp(‘/root/shinysample’)
Error in shinyAppDir(x) :
No Shiny application exists at the path “/root/shinysample”
Calls: … as.shiny.appobj → as.shiny.appobj.character → shinyAppDir
Execution halted
Docker container inspect log -log