Connect as `postgres` user to Docker container running postgres

For MacOSX usage, primarily:

Ensure you have the correct Docker environment:

$> eval "$(docker-machine env cloudviewerbox)"

... and find the running container:

$> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
44809d71d591 sameersbn/postgresql:9.4-18 "/sbin/entrypoint.sh" 2 weeks ago Up 2 hours 0.0.0.0:5432->5432/tcp slctest_postgres_1

... then attach to your Docker container with a flag indicating you want an interactive shell, and tell it to use /bin/bash:

$> docker exec -i -t 44809d71d591 /bin/bash

... and when you're in your container, prompt looks something like:

root@44809d71d591:/var/lib/postgresql#

... so then switch to superuser postgres:

root@44809d71d591:/var/lib/postgresql# su - postgres

... and when you're superuser postgres, the prompt looks like:

postgres@44809d71d591:~$

Now you can just punch in psql and access your running database as the default postgres superuser.

postgres@44809d71d591:~$ psql
psql (9.4.6)
Type "help" for help.
postgres=#

... and you're off to the races.