打包好的docker镜像如何在启动容器前进行测试
大家讲道理
大家讲道理 2017-04-27 09:02:21
0
2
790

项目在docker容器集群上跑, 每次部署会干掉旧容器, 然后根据打包好的新镜像启动容器.
这里有个严重的问题, 就是如果新的镜像出现问题, 旧容器又被干掉, 会导致业务无法访问.
请问是否有办法将打包的镜像先测试能否正确启动容器?

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all(2)
PHPzhong

The cluster is like docker swarm. When upgrading the container image, start the new container first, and then stop the old container after the new container starts normally.
When Docker starts a container, if the command in the container can start normally, it will be considered that the container starts normally. docker swarm will then stop the old container.
But for some businesses, it does 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 the Dockerfile to customize the command to check the business health. Only when the result of this command is 0, the container is considered to be started normally, so Swarm only stops the old container. https://docs.docker.com/engin...

仅有的幸福

Since it’s already a cluster, isn’t there a hot standby system? Run at least two instances of the same container, one as a backup. When upgrading, upgrade one of them first, then upgrade the rest. Similar to this

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!