How can docker deployment mirrors be updated without downtime

  docker, question

Join me and have a mirror service. The ports mapped to the outside are8787, now I need to update this mirror service, in the process of update simple how to do without downtime update?
The current plan is to use nginx as a proxy and then write a script. The update steps are as follows
1. Start a new mirror. The corresponding mapping port is9797,
2. After the mirror image is successfully started, point nginx to 9797.
3, and then redeploy8787The service, after detecting that the mirror was started successfully, pointed nginx to8787Port, then close9797Port, finally hot deployment completed.

I am too lazy to write scripts now. Is there any simple, fast and stable way? And can be flexibly rolled back.

Rancher is used for container management and docker health check is configured. Based on the health check, non-stop update will be automatically realized.