Say that you deploy a new WP site with Docker (a contrived example):
docker run -d --name=mysite_com -v /data/mysite_com:/var/sites/mysite_com wordpress
A few months later a new container is released for WordPress. This new container includes a new version of PHP.
docker pull wordpress
Now you can rename your existing container:
docker rename mysite_com mysite_com_old
Stop the old container:
docker stop mysite_com_old
Start a new container, with the new image that you pulled:
docker run -d --name=mysite_com -v /data/mysite_com:/var/sites/mysite_com wordpress
If the new container is not working, stop the new site:
docker stop mysite_com
Rename it to _notworking:
docker rename mysite_com mysite_com_notworking
Rename the old container back:
docker rename mysite_com_old mysite_com
Restart the old container:
docker start mysite_com
Remove the nonworking container:
docker rm mysite_com_notworking