R Shiny Docker App not Writing File to Container

I’m using Docker compose and published a R Shiny App. I’m able to run locally and write to drive for my App. However, when deployed to docker, my Shiny is not able to write to the directory, therefore my App fails.

Here is my docker_compose


    version: '3'
    services:
    shiny:
    restart: always
    build: ./shiny
    network_mode: “host”
    ports:
    - 3838:3838
    volumes:
    - ./shiny/:/srv/shiny-server/

I’m able to access the container from the command line and verify when my App tries to write to srv/shiny-server/app/ the file is not there. Also with the logs, I’m able to do an “ls” while exectuion, and it is indeed in the correct directory path.

Is there something with Docker I need to setup to ensure I’m able to write?

For reference here is my DockerFile:

 FROM rocker/shiny
    system libraries of general use
    RUN apt-get update && apt-get install -y
    sudo
    pandoc
    pandoc-citeproc
    libcurl4-gnutls-dev
    libcairo2-dev
    libxt-dev
    libssl-dev
    libssh2-1-dev
    libpq-dev
    
    RUN R -e ‘install.packages(“RPostgres”)’
    RUN R -e ‘install.packages(“DT”)’
    RUN R -e ‘install.packages(“httr”)’
    RUN R -e ‘install.packages(“ggplot2”)’
    RUN R -e ‘install.packages(“plotly”)’

Here is part of R Shiny code which I'm trying to write_disk from the App using response from API:

      filename <- paste0("model_results/", upload_id)
      request <- httr::GET(upload_url,write_disk(filename, overwrite=TRUE))
      out <- httr::content(request)

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