To set up something simple that allows a Postgresql connection from the docker container to my localhost I used this in postgresql.conf:
listen_addresses = '*'
And added this pg_hba.conf:
host all all 172.17.0.0/16 password
Then do a restart. My client from the docker container (which was at 172.17.0.2) could then connect to Postgresql running on my localhost using host:password, database, username and password.