Python 3.7 Docker 镜像
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/52740556/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python 3.7 Docker images
提问by David Goldfarb
I want to dockerize my python app. I went to Docker hub and discovered that there are a variety of likely-sounding base images.
我想dockerize我的python应用程序。我去了 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. Help?
尽管我尝试了 Google 搜索,但我还是无法弄清楚“stretch”、“slim”、“slim-stretch”和 alpine 之间的区别。帮助?
采纳答案by Messa
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 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. Could not find even in git revision history if it was accidentally removed.
看起来有关的信息stretch
确实丢失了。如果意外删除,即使在 git 修订历史记录中也找不到。
I have created an issue: https://github.com/docker-library/python/issues/343
我创建了一个问题:https: //github.com/docker-library/python/issues/343
Stretchis a codename for Debian 9 - currently the stable version (until 2019-07-06, when Debian 10 Busterwas released). The "oldstable" Debian 8 has codename Jessie.
Stretch是 Debian 9 的代号——目前是稳定版本(直到 2019 年 7 月 6 日,当 Debian 10 Buster发布时)。“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. And Alpine uses busyboxinstead of the full versions of many system commands.
从我有限的经验中最显着的区别是apt
对apk
与GNU的libc6与MUSL的libc。并且 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. In these cases I recoomend to use the Debian-based images.
更新:许多带有编译二进制代码的 Python 轮子可以与基于 Debian 的图像一起使用,但pip install
对于基于 Alpine 的图像,必须重新编译(由)。在这些情况下,我建议使用基于 Debian 的映像。