# Connect to host database 1. Create new database user with password for docker. 2. Configure `postgresql.conf` to listen for connection from docker network which usually is `172.17.0.0/16`. The file's usually located at `/usr/local/var/postgres/postgresql.conf` for Mac OS X. Example, add this entry into `postgresql.conf` file. ``` listen_addresses = '172.17.0.0/16, localhost' ``` 3. Configure `pg_hba.conf` to trust, password or your prefer connection from docker. The file's usually located at `/usr/local/var/postgres/pg_hba.conf` in Mac OS X. Example, add this entry into `pg_hba.conf` file. ``` host all all 172.17.0.1/16 trust ``` 4. Run docker with `--add-host` command. ``` docker run -it --rm -v $PWD:$PWD -w $PWD --add-host=docker:(ipconfig getifaddr en0) your-image ``` 5. Then you can connect to host by hostname `docker`.