EDIT 1
I change postgresql.conf and pg_hba.conf settings as mentioned here
but container can not connect to database locally:
psycopg2.Operation