'Error: "There is no package called 'leaflet'" when trying to render a docker image of shiny app

I have my docker file like this in order to render the image:

FROM openanalytics/r-base
#FROM openjdk:8-jre
# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
   gdal-bin \
    git-core \
    libcurl4-openssl-dev \
    libgmp-dev \
    libproj-dev \
    libssl-dev \
    libudunits2-dev \
    libxml2-dev \
    libglpk-dev \
    make\
    pandoc \
    pandoc-citeproc\
    default-jre-headless \
    openjdk-11-jdk \    
    unixodbc-dev 
#Ubuntu 16.04 ODBC DRIVER
ENV ACCEPT_EULA=Y
RUN apt-get install -y curl 

    
#Ubuntu 18.04 ODBC DRIVER
 

# basic shiny functionality
RUN ["install2.r", "dbplyr", "dplyr", "fontawesome", "forcats", "ggplot2", "ggridges", "leaflet", "leaflet.extras", "odbc", "purrr", "readr", "readxl", "semantic.dashboard", "shiny", "shiny.semantic", "shinydashboard", "stringr", "tibble", "tidyr", "tidyverse"]
RUN mkdir -p /opt/shinyproxy/
COPY ./gestantes /opt/shinyproxy/gestantes
COPY Rprofile.site /usr/lib/R/etc/
#RUN chmod -R 777 /opt/shinyproxy/gestantes/
WORKDIR /opt/shinyproxy/
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/opt/shinyproxy/gestantes')"]

I build my docker image like this:

docker build -t gestantes_tab .

Finally, I run the docker image:

docker run -p 3838:3838 gestantes_tab

When I try to open the app in a web browser i get the errror:

enter image description here

In my R script I have called properly all the libraries on the ui that the app needs and loaded the .Rdata with all the information needed, if I run the app from Rstudio with an empty environment it works fine, these are the libraries that I am calling:

library(shiny)
library(tidyverse)
library(shiny.semantic)
library(shinydashboard)
library(semantic.dashboard)
library(leaflet)
library(leaflet.extras)
library(ggridges)
library(fontawesome)
library(ggridges)

The process of the image looks like this, doesen´t seem to be an error:

enter image description here

Any ideas what I´m doing wrong? Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source