-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The size of the Python image - why 900MB? #30
Comments
The base tags are engineered so that almost any arbitrary thing will If you check out the |
@tianon : Isn't this bad security practice though (for the 900MB base)? There's tons of packages in PyPi and they have a lot of C dependencies also. Not all of them are maintained equally and if there is even just 1 C dependency that has an unmonitored security risk, it compromises the entire container. In terms of using the slim variant, when attempting to install a C dependency, is it done the way it normally would on a Debian/Ubuntu box with I don't mind sharing some instructions for using the slim option as the "better" way to manage a Python container, but I can't seem to find the instructions for installing it (first time using Docker). |
Yeah it is just debian in the container so make a FROM python:3-slim
RUN apt-get update \
&& apt-get install -y packageA packageB etc
COPY my-code /usr/src/my-app
CMD ["/usr/src/my-app/main.py"] |
Thank you @yosifkit && @tianon for the help so far. Apart from pre-installing the packages from the Dockerfile in the initial setup, can things also be installed within the container "on the fly"? Eg. Let's say I am currently building an arbitrary photo-sharing app. I've setup my web-stack for all the Python-based tools I need. Now, I want to do some stuff to photos using the Python Imaging Library, known as PIL (it has C dependencies). Can I (whilst working in my container), run:
to install the x-file package within the same container, or do I need to pre-plan and put everything into the Dockerfile first? |
You don't have to pre-plan everything. You can just |
Thank you. I am closing this issue for now, so that I can tinker with Docker and the instructions you guys provided. I will (try to) blog about using the slim version once I understand it myself. |
I've just been reading up on Docker.
I like how it can containerize the entire app of each specific stack, but I don't understand why the Python image to install Docker is 900MB.
From this:
https://registry.hub.docker.com/_/python/
Some people have complained about the size.
What I would like to know is what that 900MB is made up of? Is it an OS + your engine + hundreds of C dependencies? Is it a virtualized OS only? Is it 900MB of everything in Python?
Are you basically installing a 'light' virtualized Debian OS to run Python?
If yes, I think you would be lying on this page:
https://www.docker.com/whatisdocker/
By not specifying that under certain conditions, the "Docker Engine" is coupled with an OS.
Some clarification on this will be much appreciated.
The text was updated successfully, but these errors were encountered: