[英]How can I restart Docker Container when Jenkins do build?
I'm doing Spring boot CI/CD task.我正在执行 Spring 引导 CI/CD 任务。 I use Docker and put Jenkins on it and Jenkins makes my Spring project auto build.我使用 Docker 并将 Jenkins 放在上面,Jenkins 使我的 Spring 项目自动构建。
The Deployment is working well, but there's a problem. Deployment 运行良好,但存在问题。 If I did't restart docker container, the new build did not apply.如果我没有重启 docker 容器,则新构建不适用。 So when I check swagger-ui, there no changes.所以当我检查 swagger-ui 时,没有任何变化。 If I have to restart docker, I can see the changes on swagger-ui如果我必须重新启动 docker,我可以在 swagger-ui 上看到更改
What should I check in this case?在这种情况下我应该检查什么?
enter image description here enter image description here在此输入图片描述 在此输入图片描述
Unless you restart the container, it will be using the same image.除非您重新启动容器,否则它将使用相同的图像。
you can refer here你可以在这里参考
https://serverfault.com/questions/745244/does-docker-restart-use-the-latest-image-or-the-one-the-container-was-created-wi https://serverfault.com/questions/745244/does-docker-restart-use-the-latest-image-or-the-one-the-container-was-created-wi
Not sure how you are configuring the docker build, or are you using any orchestration tools.不确定您如何配置 docker 构建,或者您是否使用任何编排工具。 Please try to add configuration you are using to have more clarity to the question.请尝试添加您正在使用的配置以使问题更加清晰。
Make sure you have a force-pull turned on in the configuration if you are not changing the image tags with each builds如果您不更改每个构建的图像标签,请确保在配置中打开了强制拉取
you can also try to add restart-policies to your docker build.您还可以尝试将重启策略添加到您的 docker 构建中。 The default is NO, means it will not automatically restart.默认为NO,表示不会自动重启。 docker run --restart always docker 始终运行--重启
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.