This makes sense, and I do have a dollar sign in my password…
However, I have confirmed that postgres does in fact parse the password correctly, as I can log in with the defined username/password combo directly using psql
So I think that disproves this theory, doesn’t it?
edit: I tried getting rid of the dollar sign just in case… unfortunately I’m still getting the same error
I learned something interesting in doing some more testing…
Using the
-W
option does indeed prompt for a password, but it accepts any value entered at the password prompt. In order to actually authenticate with a password when usingpsql
, you must modify thepg_hba.conf
file to usescram-sha-256
as the method for typelocal
.When I do this, I am unable to authenticate (both while using my actual password, and also while using a password of “test”.
And then I figured out the problem.
In my
docker-compose.yml
, I had put single quotes around my postgres password, thinking this would be safe per my understanding of this question. However, just to check, I tried logging in topsql
using the password'test'
. Sure enough, it worked.I found another stack exchange with some different advice on strings in yaml: https://stackoverflow.com/questions/53082932/yaml-docker-compose-spaces-quotes
So, I tried my password again, without the single quotes… and it worked.
Perhaps this will help somebody beating their head against the wall in the future.