简体   繁体   English

Python 3.7 Docker 镜像

[英]Python 3.7 Docker images

I want to dockerize my python app.我想dockerize我的python应用程序。 I went to Docker hub and discovered that there are a variety of likely-sounding base images.我去了 Docker hub,发现有各种听起来很可能的基础镜像。

3.7.0-stretch, 3.7-stretch, 3-stretch, stretch (3.7/stretch/Dockerfile)
3.7.0-slim-stretch, 3.7-slim-stretch, 3-slim-stretch, slim-stretch, 3.7.0-slim, 3.7-slim, 3-slim, slim (3.7/stretch/slim/Dockerfile)
3.7.0-alpine3.8, 3.7-alpine3.8, 3-alpine3.8, alpine3.8, 3.7.0-alpine, 3.7-alpine, 3-alpine, alpine (3.7/alpine3.8/Dockerfile)
3.7.0-alpine3.7, 3.7-alpine3.7, 3-alpine3.7, alpine3.7 (3.7/alpine3.7/Dockerfile)

Despite my attempts at a Google search, I couldn't figure out the differeces between "stretch", "slim", "slim-stretch", and alpine.尽管我尝试了 Google 搜索,但我还是无法弄清楚“stretch”、“slim”、“slim-stretch”和 alpine 之间的区别。 Help?帮助?

The Github repo with Dockerfiles is here, but it's very dynamic and not easily readable:带有 Dockerfiles 的 Github 存储库在这里,但它非常动态且不易阅读:

https://github.com/docker-library/python https://github.com/docker-library/python

The readme is also located here:自述文件也位于此处:

https://github.com/docker-library/docs/tree/master/python https://github.com/docker-library/docs/tree/master/python

Looks like info about stretch is really missing.看起来关于stretch信息真的缺失了。 Could not find even in git revision history if it was accidentally removed.如果不小心删除,即使在 git 修订历史记录中也找不到。

I have created an issue: https://github.com/docker-library/python/issues/343我创建了一个问题: https : //github.com/docker-library/python/issues/343

Stretch is a codename for Debian 9 - currently the stable version (until 2019-07-06, when Debian 10 Buster was released). Stretch是 Debian 9 的代号——目前是稳定版本(直到 2019 年 7 月 6 日,当 Debian 10 Buster发布时)。 The "oldstable" Debian 8 has codename Jessie . “oldstable” Debian 8 的代号为Jessie

https://wiki.debian.org/DebianReleases https://wiki.debian.org/DebianReleases

My personal recommendation is to use the minimalistic Alpine images and fallback to the Debian ones if something doesn't work :)我个人的建议是使用简约的 Alpine 映像,如果出现问题,则回退到 Debian 映像 :)

Comparison of Debian vs. Alpine (from the Docker point of view if possible): Debian 与 Alpine 的比较(如果可能,从 Docker 的角度):

From my limited experience the most notable difference is apt vs. apk and GNU libc6 vs. musl libc.根据我有限的经验,最显着的区别是aptapk以及 GNU libc6 与 musl libc。 And Alpine uses busybox instead of the full versions of many system commands.并且 Alpine 使用busybox而不是许多系统命令的完整版本。

Update: Many Python wheels with compiled binary code will work with Debian-based images, but have to be recompiled (by pip install ) for Alpine-based images.更新:许多带有编译二进制代码的 Python 轮子可以与基于 Debian 的图像一起使用,但必须为基于 Alpine 的图像重新编译(通过pip install )。 In these cases I recommend to use the Debian-based images.在这些情况下,我建议使用基于 Debian 的映像。

Please notice that at the bottom of the Python Oficial Docker Hub you'll get good clues about whats in the repo.请注意,在 Python Oficial Docker Hub 的底部,您将获得有关 repo 内容的好线索。

Stretch, Apline, Buster are referring to the base OS the container uses. Stretch、Apline、Buster 指的是容器使用的基本操作系统

Stretch and Buster are consecutive versions of Debian, while Alpine is a minimalistic version for Linux based on musl and BusyBox. Stretch 和 Buster是 Debian 的连续版本,而Alpine是基于 musl 和 BusyBox 的 Linux 简约版本。

The difference in size is considerable, going up to 30x from Alpine to others, but trade-offs are to be taken in account as a better-community to better-size-performance kind.大小差异是相当大的,从 Alpine 到其他人最多可达 30,但作为更好的社区到更好的大小性能类型,需要权衡取舍

Also, take in account what your container will need to have installed and how minimalistic it can get.此外,请考虑您的容器需要安装什么以及它可以获得的简约程度。

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

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