我刚刚开始使用docker将其应用于我的应用程序。当我在做的时候,我有疑问。不过,请理解这可能是一个微不足道的问题。我在码头很新。
直观地使用OS(ubuntu)图像作为基础似乎比单纯的python要重得多。
这就是为什么我总是尝试使用python映像作为基础,尽管ubuntu有一些用例。
然而,我发现即使我使用python映像作为容器的基础,它仍然可以运行Linux(Ubuntu)命令,如apt-get、ls、ps,并且具有像ubuntu(home, root , usr)这样的文件系统结构。
它看起来仍然很小,像ubuntu。
我知道,如果我只使用ubuntu映像,我应该手动设置环境,而不是python映像。(如果我只想运行python)
除了方便方面,他们有什么区别,给出为什么我应该使用python,而不是ubuntu,例如稳定性和性能?
发布于 2017-11-01 03:05:52
您可以在python图像的文档中阅读到它的相关信息。
有趣的部分是:
这个标签是基于构建包-deps的。buildpack是为一般的码头用户设计的,他们的系统上有很多图像。从设计上看,它有大量非常常见的Debian包。
buildpack本身可以是基于Debian或Ubuntu图像的。
正如他们在文档中提到的--如果您没有特定的需求,或者不知道为什么不使用另一个映像,那么python是一个很好的选择。
将来,如果您想让部署映像小于测试映像(这可能有一些额外的工具),您可能会对其他映像感兴趣。一般情况下,您可能会尝试使用最小的大小来删除不必要的实用程序。每个人都有理由这样做--你很可能会在什么时候才知道这些对你来说有多重要。
发布于 2017-11-01 08:19:36
嗯,正如viraptor所说,Python是一个不错的选择,但它重900 MB。
Python映像的大小-为什么是900 of?
https://github.com/docker-library/python/issues/30
Yasser Martinez有一篇关于坞映像大小的博客文章(实际上只有Python映像)
http://yasermartinez.com/blog/posts/creating-super-small-docker-images.html
提取
Python itself is not small, a typical python installation needs close to 100 MB once uncompressed on the disk. Of course one could imagine that here are many files included that aren't needed in most of the usual cases (like the turtle module). Is it possible to create a smaller python docker image? The answer is YES; if you now do a docker pull elyase/staticpython you will get a working python image with only 8.5 MB in size.
另见Jo Loff的github
https://github.com/jfloff/alpine-python
提取
REPOSITORY TAG SIZE jfloff/alpine-python 2.7-slim 52.86 MB python 2.7-slim 180.8 MB
jfloff/alpine-python 2.7 234.2 MB python 2.7 676.2 MB
jfloff/alpine-python 3.4-slim 110.4 MB python 3.4-slim 193.9 MB
jfloff/alpine-python 3.4 280 MB python 3.4 681.5 MB
jfloff/alpine-python latest 248.8 MB python 3.5 685.4 MB
jfloff/alpine-python latest-slim 79.11 MB python 3.5-slim 197.8 MB
https://stackoverflow.com/questions/47047520
复制相似问题