Docker with Rstudio RPostgresql connection string timeout

Dear All,

I am very new to Docker.
I am using windows OS.
I have R code which runs on Rstudio pretty well without any issues.
working of R Code explanation as follows:-
I am performing real time analytics(sensor Domain).
As per Post request from angular calls ,r code connect to postgre database via connection string using Rpostgresql package,code snippet as follows:-
library(dplyr)
library(RPostgreSQL)
psql <- DBI::dbDriver("PostgreSQL")
con <- DBI::dbConnect(psql,
dbname = "XXXXXX_cotton",
host = "xxx.xxx.xx.xx",
port = 5432,
user = "time",
password = 'series')
This will result for fetching the data from database perform complex calculations in R studio and send to the angular side for displaying.
Till now it was working fine.
Now the Problem starts from here:-
I
I have created Docker file for same Rcode.
pull the Rstudio image from Rockerdocker with version of 3.61
Image of file get created.
When i am running the image of this container work fine till 5 minutes it gave same output as same R studio R code gaves to me.
But when after some time i.e after 10 mins of image file running it gaves me following error.
error as follows:-

RS-DBI driver: (could not run statement: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. ).

Then i again restart the container and its work fine for sometime but it again gives the same error above.

Note:the Database is non contanerized which is running on same computer.
I tried lot of approaches but non of working
Kindly help me to resolve the typical issue.

Thanks And Regards
Wishy Verma

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