gpt4 book ai didi

Python 3.7 Docker 镜像

转载 作者:IT老高 更新时间:2023-10-28 21:24:49 29 4
gpt4 key购买 nike

我想将我的 python 应用程序 dockerize。我去了 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)

尽管我尝试了 Google 搜索,但我无法弄清楚“stretch”、“slim”、“slim-stretch”和 alpine 之间的区别。帮忙?

最佳答案

带有 Dockerfiles 的 Github 存储库在这里,但它非常动态且不易阅读:

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

自述文件也位于此处:

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

看起来关于 stretch 的信息真的丢失了。如果它被意外删除,即使在 git 修订历史记录中也找不到。

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

Stretch 是 Debian 9 的代号 - 目前是稳定版本(直到 2019-07-06,Debian 10 Buster 发布)。 “oldstable” Debian 8 的代号为 Jessie

https://wiki.debian.org/DebianReleases

我个人的建议是使用简约的 Alpine 镜像,如果出现问题,则回退到 Debian 镜像 :)

Debian 与 Alpine 的比较(如果可能,从 Docker 的角度来看):

根据我有限的经验,最显着的区别是 aptapk 以及 GNU libc6 与 musl libc。而Alpine使用busybox而不是许多系统命令的完整版本。

更新:许多带有已编译二进制代码的 Python 轮子可以与基于 Debian 的图像一起使用,但对于基于 Alpine 的图像,必须重新编译(通过 pip install)。在这些情况下,我建议使用基于 Debian 的镜像。

关于Python 3.7 Docker 镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52740556/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com