Python 3.7 Docker映像 [英] Python 3.7 Docker images

查看:135
本文介绍了Python 3.7 Docker映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对我的python应用进行docker化。我去了Docker集线器,发现那里有很多听起来不错的基本映像。

I want to dockerize my python app. I went to Docker hub and discovered that there are a variety of likely-sounding base images.

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搜索,但我不知道有什么区别在伸展,苗条,苗条伸展和高山之间。

Despite my attempts at a Google search, I couldn't figure out the differeces between "stretch", "slim", "slim-stretch", and alpine. Help?

推荐答案

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

The Github repo with Dockerfiles is here, but it's very dynamic and not easily readable:

https://github.com/docker-library/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.

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

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

Stretch is a codename for Debian 9 - currently the stable version (until 2019-07-06, when Debian 10 Buster was released). The "oldstable" Debian 8 has codename Jessie.

https://wiki.debian.org/DebianReleases

我个人的建议是使用简约的Alpine图像并回退到Debian,如果某些事情不起作用:)

My personal recommendation is to use the minimalistic Alpine images and fallback to the Debian ones if something doesn't work :)

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

Comparison of Debian vs. Alpine (from the Docker point of view if possible):

https://nickjanetakis.com/blog/the-3-biggest-wins-当使用高山作为基础docker映像时

最显着的区别是 apt apk 和GNU libc6与mu sl libc。并且Alpine使用 busybox 而不是许多系统命令的完整版本。

From my limited experience the most notable difference is apt vs. apk and GNU libc6 vs. musl libc. And Alpine uses busybox instead of the full versions of many system commands.

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

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 recommend to use the Debian-based images.

这篇关于Python 3.7 Docker映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆