root@27a0239d18d7:/# psql -U postgres
postgres=# CREATE USER johndoe WITH PASSWORD ‘123456’;
postgres=# ALTER USER johndoe WITH SUPERUSER;
postgres=# GRANT ALL PRIVILEGES ON DATABASE “yourDatabaseName” to johndoe;
Make sure that you assign the user to SUPERUSER else you will encounter an error that says PG::InsufficientPrivilege: ERROR: permission denied for relation schema_migrations…

To test it out do this..
root@27a0239d18d7:/# psql -h localhost -d “yourDatabaseName” -U johndoe -W