Python 3.7 Docker images

前端 未结 2 842
滥情空心
滥情空心 2021-02-01 15:03

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-st         


        
相关标签:
2条回答
  • 2021-02-01 15:50

    Please notice that at the bottom of the Python Oficial Docker Hub you'll get good clues about whats in the repo.

    Stretch, Apline, Buster are referring to the base OS the container uses.

    Stretch and Buster are consecutive versions of Debian, while Alpine is a minimalistic version for Linux based on musl and BusyBox.

    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.

    Also, take in account what your container will need to have installed and how minimalistic it can get.

    0 讨论(0)
  • 2021-02-01 15:54

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

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

    The readme is also located here:

    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.

    I have created an issue: 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). The "oldstable" Debian 8 has codename Jessie.

    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 :)

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

    • https://www.turnkeylinux.org/blog/alpine-vs-debian

    • https://nickjanetakis.com/blog/the-3-biggest-wins-when-using-alpine-as-a-base-docker-image

    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.

    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.

    0 讨论(0)
提交回复
热议问题