The project runs on the docker container cluster. Each deployment will kill the old container and then start the container according to the packed new image.
There is a serious problem here, that is, if there is a problem with the new image and the old container is killed again, the business cannot be accessed.
Is there any way to test whether the packaged image can start the container correctly?
The cluster is like docker swarm. When upgrading the container image, start the new container first, and stop the old container after the new container starts normally.
When Docker starts the container, if the commands in the container can start normally, the container will be considered to start normally. DockersSwarm will immediately stop the old container.
However, some businesses do not mean that the successful start of the process in the container means that the business is normal. At this time, you can use the healthcheck instruction in Dockerfile to customize the command to check the business health. Only when the result returned by this command is 0 will the container start normally, so swarm will stop the old container.https://docs.docker.com/engin …