[英]Dockerfile vs Docker image
I'm working on creating some docker images to be used for testing on dev machines. 我正在创建一些用于在开发机器上进行测试的docker镜像。 I plan to build one for our main app as well as one for each of our external dependencies (postgres, elasticsearch, etc).
我计划为我们的主应用程序构建一个,以及为每个外部依赖项构建一个(postgres,elasticsearch等)。 For the main app, I'm struggling with the decision of writing a Dockerfile or compiling an image to be hosted.
对于主应用程序,我正在努力编写Dockerfile或编译要托管的映像。
On one hand, a Dockerfile is easy to share and modify over time. 一方面,Dockerfile很容易随时间共享和修改。 On the other hand, I expect that advanced configuration (customizing application property files) will be much easier to do in vim before simply committing an new image.
另一方面,我希望在提交新图像之前,在vim中更容易进行高级配置(自定义应用程序属性文件)。
I understand that I can get to the same result either way, but I'm looking for PROS, CONS, and gotchas with either direction. 我知道我可以得到相同的结果,但我正在寻找PROS,CONS和任何方向的问题。
As a side note, I plan on wrapping this all together using Fig . 作为一个方面说明,我计划在所有包装了一起利用图 。 My initial impression of this tool has been very positive.
我对这个工具的初步印象非常积极。
Thanks! 谢谢!
Using a Dockerfile: 使用Dockerfile:
Changing a container and committing the changes is great for testing purposes and for fast development for a conceptual test. 更改容器并提交更改非常适合测试目的和概念测试的快速开发。 But if you plan to use the result image for some time, I would definitely use Dockerfiles.
但是如果你计划使用结果图像一段时间,我肯定会使用Dockerfiles。
Apart from this, if you have to modify a file and doing it using bash tools (awk, sed...) results very tedious, you can add any file you wish from outside during the building process. 除此之外,如果您必须修改文件并使用bash工具(awk,sed ...)进行操作,结果非常繁琐,您可以在构建过程中从外部添加任何您想要的文件。
I totally agree with Javier but you need to understand that one image created with a dockerfile can be different with an image build with the same version of the dockerfile 1 day after. 我完全同意Javier,但是您需要了解使用dockerfile创建的一个映像可能与使用相同版本的dockerfile的映像构建不同。
maybe in your build process you retrieve automatically last updates of an app or the os etc … 也许在您的构建过程中,您自动检索应用程序或操作系统等的最新更新...
And at this time if you need to reproduce a crash or whatever you can't rely on the dockerfile. 此时如果你需要重现崩溃或任何你不能依赖于dockerfile的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.