Updating software in a docker container
Migrating data directory between major db version can be problematic.

I can suggest to create and restore db dump.
You can upgrade postgresql db container as follow:


Backup database  
Shutdown postgres 11 container 
Run new postgres 12 container 
Restore backup


or single line command:

docker exec postgres-11-container pg_dumpall -U postgres | docker exec -i postgres-12-container psql -U postgres