How to keep the container alive when the primary process needs to restart to upgrade

We have a primary (java) process that is started with a shell script. That java process can be updated when its version changes. The update process involves the primary java process spawning another java program that will restart the primary after the update is applied.

What is the best way to keep the container alive while all of this is going on?

thx!
–Carl–

PS I understand that the correct way to do this is roll out updates with orchestration but this is a legacy system that we are trying to migrate quickly.

After running into this issue and several others, we have had to scrap our plans to migrate to Docker at this time. It is simply not a good fit for us at this stage in its development (Docker, Swarm, Kubernetes). We will keep looking at it going forward and hope it will one day fit.