A
A
Andrey Ermolaev2021-05-03 08:07:22
PostgreSQL
Andrey Ermolaev, 2021-05-03 08:07:22

Why does container return role "postgres" does not exist error?

Cloned the repository to the cloud. Nginx + django + PostgreSQL Containers started, then plugging.

I try to migrate, I get:

File "/usr/local/lib/python3.8/site-packages/psycopg2/__init__.py", line 127, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: FATAL:  database "foodgram" does not exist


I'm trying to create a database through the container, I get a strange error in general.

[email protected]:/home/dronsovest/foodgram-project# docker exec -it 86235d81aa7d psql -U postgres
psql: error: could not connect to server: FATAL:  role "postgres" does not exist


How can a container from the default postgres12 image not see the postgres role of the user of the same name?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shinyaev, 2021-05-13
@Shpawel

How do you start a container with Postgresql?
Perhaps you do not specify POSTGRES_PASSWORD and then the database cannot be initialized.
See section *How to use this image*

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question