我可以在不重建应用程序的情况下将应用程序更新推送到Docker映像吗? [英] Can I push application updates to docker image without rebuilding?

查看:56
本文介绍了我可以在不重建应用程序的情况下将应用程序更新推送到Docker映像吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在生产中具有带有Web服务器,数据库服务器和Web应用程序的Docker映像.

Let's say that I have docker image with web server, database server and web application in production.

我可以在不破坏数据库服务器的情况下将应用程序更新推送到生产容器吗?

Can I push applications updates to the production container, without destroying the database server ??

推荐答案

我建议您阅读微服务架构,因为您似乎在将Docker映像等同于轻量级VM映像具有逻辑上的谬误.我使用的逻辑是,VM将OS与主机隔离,而容器将进程及其子节点与主机隔离.因此,您不希望Web服务器,数据库服务器和Web应用程序位于同一映像上,它们将是2-3个单独的映像(取决于应用程序的运行方式).

I'd recommend reading up on the microservices architecture, because you seem to be making the logical fallacy of equating a Docker image to a lightweight VM image. The logic I use is that VMs isolate an OS from the host, while containers isolates a process and it's children from the host. Therefore, you don't want a web server, database server, and web application on the same image, those would be 2-3 separate images (depending on how your application runs).

应该将图像视为不可变的,您对容器所做的任何更改都应在完全重新启动后丢失.数据位于映像之外的卷上,并附加到容器上.如果通过数据量推送更新,则该更改将立即生效,而无需任何重新启动,但是如果将应用程序移动到该量中,您还将失去拥有版本不变的映像的许多优点.是否需要将所有容器一起重新启动,或者是否可以拉出并更换单个容器,或者是否可以在分解旧版本以提供100%正常运行时间之前启动新版本,这取决于体系结构的设计.

Images should be considered immutable, any changes you make to the container should be lost on a full restart. Data is located on volumes, outside of the image and is attached to a container. If you push an update via the data volume, then that change is immediately live without any restart, but you also lose many of the advantages of having versioned immutable images if you move your app into a volume. Whether your containers need to all be restarted together, or if you can pull and replace a single container, or if you can spin up the new version before spinning down the old version to give 100% uptime, depends on the design of your architecture.

这篇关于我可以在不重建应用程序的情况下将应用程序更新推送到Docker映像吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆