django – How to work with postgresql in docker?


It just so happened that I had to work with a django project in docker for the first time. Now when I try to apply migrations with the command

docker-compose run --rm rest python migrate

The error django.db.utils.ProgrammingError: column does not exist

I thought to read the table, but I don't understand how to get into the database. How do I get to my postgresql db in docker? Safety does not bother, you can even completely demolish.


The storage of the database itself is usually located outside the container, so that when you restart it, your database is not reset, this usually happens by mounting the directory where the data will be located.

But to access the database as such, you need the appropriate GUI you can install it directly into the container or find a ready-made image. You can also directly access the database through bash , for this, look towards the docker exec , using this command you will get access to the container bash of your database.

Scroll to Top