简体   繁体   English

Kubernetes和Dockerfile

[英]Kubernetes and Dockerfile

People using Docker have probably used dockerfiles as master templates for their containers. 使用Docker的人可能已经将dockerfiles用作其容器的主模板。

Does Kubernetes allow re-use of existing dockerfiles? Kubernetes是否允许重用现有的dockerfile? Or will people need to port that to Kubernetes .yaml -style templates? 还是人们需要将其移植到Kubernetes .yaml样式的模板?

I'm not aware of tools for doing so or people that have been trying this. 我不知道执行此操作的工具或尝试过此操作的人。

Dockerfiles and the Kubernetes resource manifests (the yaml files) are somewhat orthogonal. Dockerfile和Kubernetes资源清单(yaml文件)有些正交。 While you could pull some information from the Dockerfile to prepopulate the Kubernetes manifest, it'd only be able to fill in a very small subset of the options available. 虽然您可以从Dockerfile中提取一些信息来预填充Kubernetes清单,但它只能填充可用选项的很小一部分。

You can think of Dockerfiles as describing what is packaged into your container image, while the Kubernetes manifests specify how your container image is deployed -- which ports are exposed, environment variables are added, volumes are mounted, services made available to it; 您可以将Dockerfile视为描述了打包到容器映像中的内容,而Kubernetes清单指定了如何部署容器映像-公开了哪些端口,添加了环境变量,安装了卷,为其提供了服务; how it should be scheduled, health checked, restarted; 应该如何安排,运行状况检查,重新启动; what its resource requirements are; 它的资源需求是什么; etc. 等等

I think what you are referring to are your docker-compose files. 我认为您指的是您的docker-compose文件。 These guys are responsible for orchestrating your 'service'. 这些家伙负责编排您的“服务”。 If you have docker-compose files there is a tool that can help convert them to k8 manifests. 如果您有docker-compose文件,则有一个工具可以帮助将它们转换为k8清单。

https://github.com/kubernetes/kompose https://github.com/kubernetes/kompose

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM