Docker-ShinyApp doesn't allow to communicate with remote postgres database

Hi community,
I have developed a shinyapp that communicate with remote postgres database by using Docker.

When i have tried to execute the query to the remote server with rpostgis i have the follow error

Warning: Error in : could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

The dockerfile is the follow one

FROM rocker/r-ver:4.0.5
RUN apt-get update && apt-get install -y  gdal-bin git-core imagemagick libcurl4-openssl-dev libfontconfig1-dev libgdal-dev libgeos-dev libgeos++-dev libgit2-dev libicu-dev libpng-dev libpq-dev libproj-dev libssl-dev libudunits2-dev libxml2-dev make pandoc pandoc-citeproc && rm -rf /var/lib/apt/lists/*
RUN echo "options(repos = c(CRAN = 'https://cran.rstudio.com/'), download.file.method = 'libcurl', Ncpus = 4)" >> /usr/local/lib/R/etc/Rprofile.site
RUN R -e 'install.packages("remotes")'
RUN Rscript -e 'remotes::install_version("glue",upgrade="never", version = "1.4.2")'
RUN Rscript -e 'remotes::install_version("processx",upgrade="never", version = "3.5.2")'
RUN Rscript -e 'remotes::install_version("stringr",upgrade="never", version = "1.4.0")'
RUN Rscript -e 'remotes::install_version("htmltools",upgrade="never", version = "0.5.2")'
RUN Rscript -e 'remotes::install_version("systemfonts",upgrade="never", version = "1.0.3")'
RUN Rscript -e 'remotes::install_version("sf",upgrade="never", version = "1.0-3")'
RUN Rscript -e 'remotes::install_version("shiny",upgrade="never", version = "1.7.1")'
RUN Rscript -e 'remotes::install_version("leaflet",upgrade="never", version = "2.0.4.1")'
RUN Rscript -e 'remotes::install_version("pkgload",upgrade="never", version = "1.2.2")'
RUN Rscript -e 'remotes::install_version("attempt",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("rgeos",upgrade="never", version = "0.5-8")'
RUN Rscript -e 'remotes::install_version("RPostgreSQL",upgrade="never", version = "0.7-2")'
RUN Rscript -e 'remotes::install_version("mapview",upgrade="never", version = "2.10.0")'
RUN Rscript -e 'remotes::install_version("leaflet.extras",upgrade="never", version = "1.0.0")'
RUN Rscript -e 'remotes::install_version("testthat",upgrade="never", version = "3.1.0")'
RUN Rscript -e 'remotes::install_version("config",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("spelling",upgrade="never", version = "2.2")'
RUN Rscript -e 'remotes::install_version("shinyvalidate",upgrade="never", version = "0.1.1")'
RUN Rscript -e 'remotes::install_version("shinyjs",upgrade="never", version = "2.0.0")'
RUN Rscript -e 'remotes::install_version("shinyalert",upgrade="never", version = "2.0.0")'
RUN Rscript -e 'remotes::install_version("RPostgres",upgrade="never", version = "1.4.1")'
RUN Rscript -e 'remotes::install_version("golem",upgrade="never", version = "0.3.1")'
RUN Rscript -e 'remotes::install_version("DT",upgrade="never", version = "0.19")'
RUN Rscript -e 'remotes::install_version("cicerone",upgrade="never", version = "1.0.4")'
RUN Rscript -e 'remotes::install_version("bs4Dash",upgrade="never", version = "2.0.3")'
RUN Rscript -e 'remotes::install_version("blastula",upgrade="never", version = "0.3.2")'
RUN Rscript -e 'remotes::install_github("r-lib/rlang@dc03e4473000d0424dacd4c8cf08211b7fb8bc97")'
RUN Rscript -e 'remotes::install_github("JohnCoene/waiter@ce5fdaa1fc1224ba657c0906c7900b275cfee1d7")'
RUN Rscript -e 'remotes::install_github("mablab/rpostgis@74a6ac71bcc21b7b5edf0ed6b59dcbfd4d7bfc59")'
RUN Rscript -e 'remotes::install_github("r-spatial/mapedit@8328411a45513f788dc25e6b4214df53363d6494")'
RUN mkdir /build_zone
ADD . /build_zone
WORKDIR /build_zone
RUN R -e 'options(warn = 2);remotes::install_local(upgrade="never")'
RUN rm -rf /build_zone
EXPOSE 5432
EXPOSE 80
CMD R -e "options('shiny.port'=80,shiny.host='0.0.0.0');ReportSatellite::run_app()"

Someone can help me to solve this issue?

This topic was automatically closed 21 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.