I just started leaning docker
to apply it to my application. While I am doing, I have had question. Please understand it could be trivial question though. I am very new at docker.
Intuitively using an OS( ubuntu
) image as base seems more heavy than just pure python
relatively.
That has been why I always try to use just python
image as base even though there are some use cases with ubuntu
.
However, I found even I use python
image as base for a container It still can run Linux( Ubuntu
) commands like apt-get
, ls
, ps
and have a file system structure like as ubuntu
( home, root , usr
).
It looks still tiny OS like ubuntu
.
I know If I use just ubuntu
image I should set up the environment manually by contrast with python
image.(If all I want is running python)
Except for convenience aspect, Do they have any difference giving a reason I should use python
other than ubuntu
for example stability and performance?
You can read about the python
image in its documentation
The interesting part is:
This tag is based off of buildpack-deps. buildpack-deps is designed for the average user of docker who has many images on their system. It, by design, has a large number of extremely common Debian packages.
And buildpack-deps itself can be based on either Debian, or Ubuntu image.
As they mention in the documentation - if you don't have specific requirements, or don't know why you'd not use another image, then python
is a good choice.
In the future, you may be interested in other images if you for example want to have your deployment image smaller than the one testing with (which may have some extra tools). Or in general you could be tempted to use the smallest size possible to remove unnecessary utilities. There are reasons to do each of these - you'll likely figure out yourself at what point these matter to you.
Well, as viraptor says, Python is a good choice, but it weighs 900 MB
The size of the Python image - why 900MB?
https://github.com/docker-library/python/issues/30
There is a great blog post about the size of the docker images (in fact only the Python docker images) by Yasser Martinez
http://yasermartinez.com/blog/posts/creating-super-small-docker-images.html
Extract
Python itself is not small, a typical python installation needs close to 100 MB once uncompressed on the disk. Of course one could imagine that here are many files included that aren't needed in most of the usual cases (like the turtle module). Is it possible to create a smaller python docker image? The answer is YES; if you now do a docker pull elyase/staticpython you will get a working python image with only 8.5 MB in size.
See also the github of João Ferreira Loff
https://github.com/jfloff/alpine-python
Extract
REPOSITORY TAG SIZE jfloff/alpine-python 2.7-slim 52.86 MB python 2.7-slim 180.8 MB
jfloff/alpine-python 2.7 234.2 MB python 2.7 676.2 MB
jfloff/alpine-python 3.4-slim 110.4 MB python 3.4-slim 193.9 MB
jfloff/alpine-python 3.4 280 MB python 3.4 681.5 MB
jfloff/alpine-python latest 248.8 MB python 3.5 685.4 MB
jfloff/alpine-python latest-slim 79.11 MB python 3.5-slim 197.8 MB
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.