1

after installing docker-gramex connecting app to database server running on host machine fails for connection URL: 'postgresql://db_user:db_passwd@localhost:5432/db_name' throws psycopg2.OperationalError could not connect to server: Connection refused Error persist even after making changes given in blog-post

Joshua Baboo
  • 525
  • 1
  • 4
  • 17
  • similar, but different from scenario mentioned in [connecting to host](https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach) – Joshua Baboo Apr 15 '20 at 13:56

1 Answers1

1

On AWS-EC2 with ubuntu, starting gramex using cmd: docker run --network=host \ --name my-instance \ -d -i -t -p 9998:9998 \ -v "$(pwd)":"$(pwd)" -w "$(pwd)" \ gramener/gramex

it allows pandas to connect to postgresql server running on the host machine with the connection URL: 'postgresql://db_user:db_passwd@localhost:5432/db_name' param: --network=host makes it work.

Joshua Baboo
  • 525
  • 1
  • 4
  • 17