Error when migrating to an external postgres instance

When you rebuilt did it generate a new blank site? If not, then you’ve got some problem there.

Can you access the database from inside the container with psql <some switches to point to the database>)

Inside the container, if you do a set|grep DB do you see your ENV variables?