Problem rebuilding because of slow database shutdown

You can check out Move from standalone container to separate web and data containers

You can build a new container while the old one continues to run. You don’t need to shut down the database to build a new container.

There is now a 10 minute window for shutting down postgres, which should solve your current problem. Once you do one more rebuild, you’ll have the 10 minutes instead of one.