Last Updated: February 25, 2016
·
428
· Lorin Hochstein

Connect to postgres running inside boot2docker

If you run a postgres container using boot2docker, this one-liner will connect the psql client.

PGPASSWORD=dbpassword psql -h $(boot2docker ip) -p $(docker inspect postgres | jq -r '.[0].NetworkSettings.Ports["5432/tcp"][0].HostPort') -U dbuser dbname

This requires jq