Docker-compose environment variables

I struggled with this for a while and wasn’t having luck with the accepted answer, I finally got it to work by removing the container:

docker-compose rm postgres

And then the volume as well:

docker volume rm myapp_postgres

Then when I did a fresh docker-compose up I saw CREATE ROLE fly by, which I’m assuming is what was missed on the initial up.


The reasons for this are elaborated on here, on the Git repo for the Docker official image for postgres.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)