3👍
✅
You’re not using the username and the password you provided in your docker-compose file. Try this and then enter my_password
:
docker exec -it container_id psql -U my_user -d my_db --password
Check the official documentation to find out about the PostgreSQL terminal.
0👍
I would also like to add, in your compose file you’re not exposing any ports for the db container. So it will be unreachable via external sources (you, your app or anything that isn’t ran within that container).
- [Django]-Create input mask for use in django forms
- [Django]-Can I have 2 Django sites using 2 different version of Python on 1 domain?
- [Django]-Django QuerySet/Manager filter employees by age from birthday
- [Django]-TypeError: 'datetime.date' object has no attribute '__getitem__'
- [Django]-Django-mptt tree rebuild error
0👍
I think you need to add environment
to project container.
environment:
- DB_HOST=db
- DB_NAME=my_db
- DB_USER=youruser
- DB_PASS=yourpass
depends_on:
- db
add this before depends_on
And now see if it solves
- [Django]-Can't get celery to do INFO logging the same way Django does it
- [Django]-Conditional nested filters in Django
0👍
You should add ports to the docker-compose for the postgres image,as this would allow postgres to be accessible outside the container
- ports:
"5432:5432"
You can checkout more here docker-compose for postgres
Source:stackexchange.com