After I finish my project and move it to docker, I met some very strange problems related to database. I did run

sudo docker-compose run web python3 manage.py makemigrationssudo docker-compose run web python3 manage.py migrate

but both of them shows no change detected.

After trying everything I can find but failed, I decided to clean up all the containers and then rebuild them.

If you met something similar(and strange), this might be helpful. NOTE: delete the container will lose all the data inside

  1. Delete all the containers

sudo docker rm $(sudo docker ps -a -q) -f

  1. Delete all the volumes

sudo docker volume prune

If you don't want to delete all volumes, you can delete a particular one

sudo docker volume lssudo docker volume rm <name_of_volume>

3. Rebuild them

sudo docker-compose up --build