简体   繁体   English

有关Docker配置和相应操作系统选择的问题

[英]Questions about Docker's configuration and the selection of OS accordingly

I am planning to build an environment for Web services using ECS at Docker. 我计划在Docker上使用ECS构建Web服务环境。
However I am in trouble because I do not know what to do with the OS inside Docker. 但是我很麻烦,因为我不知道如何处理Docker内部的OS。

I heard that it is common to build Docker individually for each service for general construction of Docker. 我听说通常为每个服务单独构建Docker,以进行Docker的一般构建。
At first, there was a Docker that gathers Docker, and imagined in which Docker (server, DB, Redis ...) was created for each role. 最初,有一个Docker聚集了Docker,并想象为每个角色创建Docker(服务器,DB,Redis ...)的方式。
If this is done, if you set Docker's OS for each role to general LinuxOS (such as CentOS), it seems that it will increase considerably only by OS memory capacity. 如果这样做,将每个角色的Docker OS设置为一般的LinuxOS(例如CentOS),似乎只有OS内存容量会大大增加。
I just realized that there is a compact OS called CoreOS. 我刚刚意识到有一个名为CoreOS的紧凑型操作系统。

Then there are doubts. 然后有疑问。
Is it common for Docker's OS to be set to CoreOS for each role? 对于每个角色,将Docker的OS设置为CoreOS是常见的吗?
Is the assumption that I wrote so far is common? 到目前为止我写的假设很普遍吗?

It will be helpful if you can answer. 如果您可以回答,将很有帮助。

Not sure I understand the question, but you seem to misunderstand "layers" of a Docker image. 不确定我是否理解这个问题,但是您似乎误解了Docker映像的“层”。

The base OS doesn't really matter all that much as long as you know how to install and manage services for that container OS. 只要您知道如何为该容器操作系统安装和管理服务,基本操作系统就没有多大关系。

For minimal base images, you can pick Alpine or CoreOS. 为了使基本图像最少,可以选择Alpine或CoreOS。 For more substantial OS's that might match your production systems, then you can pick from Debian, CentOS, or Ubuntu. 对于可能与您的生产系统匹配的更强大的OS,则可以从Debian,CentOS或Ubuntu中进行选择。

For more reading see Elasticsearch switched to CentOS as a base . 有关更多信息,请参阅Elasticsearch切换为CentOS作为基础

You'll find that things are often easier to install when you can use apt or yum install 您会发现,使用aptyum install时,安装起来通常更容易

increase considerably only by OS memory capacity 仅通过OS内存容量显着增加

Only once per machine (assuming running in a cluster/swarm), though. 但是,每台计算机一次 (假设在集群/群集中运行)。 For example, if you share a base CentOS image between your web app and Redis Docker images, then only the extra layers to build the respective apps are created. 例如,如果您在Web应用程序和Redis Docker映像之间共享基本的CentOS映像,则仅创建用于构建各个应用程序的额外层。

For a visual, let's assume I have a Python (or Ruby, Node, Golang, etc.) web app, a CLI utility written using that same language, and a database image built on one machine. 为了获得视觉效果,我们假设我有一个Python(或Ruby,Node,Golang等)Web应用程序,使用相同语言编写的CLI实用程序以及在一台计算机上构建的数据库映像。 You would build a general Python layer, then extend that onto the web and CLI images. 您将构建一个通用的Python层,然后将其扩展到Web和CLI映像。 All images build from the same base OS image 所有映像均基于同一基本操作系统映像构建

----------------
|  Web | CLI   |
---------------------
|    Python    | DB |
---------------------
|     Base image    |
---------------------

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

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