Why is "rebuild" so tightly coupled to container run status?

I may be wrong, but I feel @CodeGnome’s question about zero-downtime rebuilds still merits further investigation.

If I understand Docker correctly, the following aspects of Discourse could be rebuilt in the background in a new container while the existing container is still running:

  • Update Discourse source
  • Update OS level dependencies, like Ruby major verson
  • Update the Docker image. Just as an example, earlier this year we changed from Ubuntu 16.04 to last Debian and all is transparent to the user, just type ./launcher rebuild app .

Regarding breaking PostgreSQL changes, that’s more fiddly due to the volume, which, I assume, is shared between the old and new containers.

Perhaps the site could be put in read-only mode at the start of the rebuild, with the old container keeping its existing volume, and the newly-building database could operate within a new Docker volume?