I was setting up my django project and postgres but everytime I was getting this error
role doesn't exist
or
Db doesn't exist
So when I only tried to setup postgres and see if postgres is creating user and db correctly, but it wasn't
Here is my docker compose file :
version: "3"
services:
templates_db:
image: postgres:9.6
ports:
- "5432:5432"
environment:
- POSTGRES_USER=my_user
- POSTGRES_PASSWORD=my_pass
- POSTGRES_DB=my_db
volumes:
- ./data/postgres:/var/lib/postgresql/data
I ran my compose file using docker-compose up --build and got below logs
templates_db_1 | LOG: database system was interrupted; last known up at 2017-05-16 05:48:39 UTC
templates_db_1 | LOG: database system was not properly shut down; automatic recovery in progress
templates_db_1 | LOG: invalid record length at 0/14F0080: wanted 24, got 0
templates_db_1 | LOG: redo is not required
templates_db_1 | LOG: MultiXact member wraparound protections are now enabled
templates_db_1 | LOG: database system is ready to accept connections
templates_db_1 | LOG: autovacuum launcher started
When I logged into postgres shell as
docker exec -it **container_id** sh su - postgres $ psql postgres=# \l
It didn't have the db I mentioned in compose file my_db