I have been using ShinyProxy on DigitalOcean to deploy Flexdashboards for a couple of years with great success. My Docker file structure is based on Tim Schendzielorz file structure. Most recently I deployed a dashboard in December 2022 with no problem. This week I have been developing a new dashboard which is very much a copy and paste from the December dashboard - it has a different name, Rmd file and data that it pulls in is different, but the core of the Docker file is the same.
The Rmd file runs fine in RStudio, the image builds without warning, but when I try to spin up a local container with
docker run --name=my_data_dashboard_container --rm -p 3838:3838 my_data_dashboard
When I open the localhost:3838 it says “Not Found” The container logs have
> rmarkdown::run(’/bin/MY_Data_System.Rmd’, shiny_args = list(port = 3838, host = ‘0.0.0.0’))
Loading required package: shiny
Listening on http://0.0.0.0:3838
It stops there. The normal steps for running the Rmd file are not following.
When I return to the dockerfile that I successfully deployed in December 2022 when I build it with
docker build -f oldDockerFile -t former_data_dashbaord .
I can spin up a local container without problem as before
But when I do a no-cahe build
docker build -f oldDockerFile -t former_data_dashbaord . --no-cache
I am getting the exact same problem
All I can think is that since December 2022 something has changed in the underlying software that means it can’t find the Rmd file in the /bin. I have checked that it is there in /usr/bin/MY_Data_System.Rmd
and it is there in the paths /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
I would be grateful for any suggetsions as to what I am doing wrong, as I said this has worked well, and has stopped working in the past month.
My Dockerfile looks like this (based on Tim Schendzielorz file):
FROM openanalytics/r-shiny
MAINTAINER Me "me@gmail.com"
# system libraries of general use
RUN apt-get update && apt-get install -y apt-transport-https \
libxml2-dev \
libudunits2-dev \
libssh2-1-dev \
libcurl4-openssl-dev \
libsasl2-dev \
libv8-dev\
libproj-dev \
binutils \
gdal-bin \
libgdal-dev \
# following libs not installed as no Database connection needed
#libmariadbd-dev \
#libmariadb-client-lgpl-dev \
#unixodbc-dev \
#libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# install needed R packages
RUN R -e "install.packages(c('tidyverse', 'flexdashboard', 'knitr', 'plotly', 'shiny', 'sp', 'leaflet', 'lubridate', 'shinythemes', 'DT', 'leaflet.providers', 'remotes'), dependencies = TRUE, repos='https://cran.r-project.org/')"
# make directory and copy Rmarkdown flexdashboard file in it
RUN mkdir -p /bin
RUN mkdir -p /bin/scripts
RUN mkdir -p /bin/data
COPY MY_Data_System.Rmd /bin/MY_Data_System.Rmd
COPY scripts/* /bin/scripts/
COPY data/* /bin/data
# make all app files readable (solves issue when dev in Windows, but building in Ubuntu)
RUN chmod -R 755 /bin
# expose port on Docker container
EXPOSE 3838
# run flexdashboard as localhost and on exposed port in Docker container
CMD ["R", "-e", "rmarkdown::run('/bin/MY_Data_System.Rmd', shiny_args = list(port = 3838, host = '0.0.0.0'))"]