-
Notifications
You must be signed in to change notification settings - Fork 799
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
Switch back from debian to ubuntu in hub and singleuser-sample images, and bump python to 3.10 #2921
Conversation
4df00df
to
a46f609
Compare
a46f609
to
01aad6c
Compare
ubuntu slim is almost twice debian slim? Do you know what accounts for that? Both use micromamba? Another option that's a smaller change if we still want to opt-in to Python versions is to use the deadsnakes ppa. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to go ahead with this from me. If you'd like to explore keeping Python from apt via deadsnakes, that works for me, too. I'm also okay with sticking to the LTS Python, since we aren't very sensitive to Python versions here.
We do have one debugging tool (py-spy) in requirements.in that we could shift to the non-slim image. Because it's a debugging tool instead of a running-the-hub tool, I don't think resolving the strict pins via the lockfile is important.
Python:3.9 install vs micronamva install is the difference of relevance i think. I'll look into deadsnakes ppa |
Arrrgh this is soo hard...
Ideally we would have a This PR as it is now isn't going to be very good as it endangers function of the freeze script - we would use a debian based environment and use it in a python based environment. Maybe that is okay though? Can we do that? @minrk what do you think about staying with |
I don't think pip-compile will produce different results based on the linux distro (as long as it isn't alpine), so a regular debian-based python image should still be able to freeze for ubuntu as long as the Python x.y version matches. |
@minrk pweh okay, then I think we should go for this PR as it is for now. I invested some hours but failed to optimize this further using deadsnakes ppa - both in terms of complexity and image size. |
@minrk I trialed building https://github.com/docker-library/python/blob/master/3.11/slim-bullseye/Dockerfile but replacing it the base image with I'm very exited about having such size reduction, but unsure about how to go about it sustainable from an open source perspective as that project isn't interested in adding such build. |
This seems fine to me. In practice does reducing the image size further make much practical difference in the context of a full deployment? It's a potential large relative reduction, but I don't think we need to expend significant effort on saving 300MB when most people using docker-stacks will be pulling multi-GB images anyway. Do we need to document the new slim hub image somewhere, e.g. on https://z2jh.jupyter.org/en/stable/administrator/optimization.html or https://z2jh.jupyter.org/en/stable/administrator/security.html ? |
Now I'm again conflicted about going for a switch back to Ubuntu, as it could be a fault in the container scanners - that mainly gets whats considered resolved in ubuntu but not in debian. See docker-library/python#708 (comment). Overall, I'm very happy about the I'm thinking maybe we should go for #2920 and wait with this. I'm conflicted... If we could choose |
Another strategy I've considered is to Another great outcome would be if we could do something like
But also more things a bit messier to extract, making it tricky. I've concluded this using the tool |
@manics yeah maybe its overkill to care about MBs. If you upgrade, and the upgrade is by recreating the hub container, the MB/s and MB combines to an added downtime during upgrades, and added downtime while relocating to another node etc. Good point about documentation, and thanks for concrete suggestions!! |
Closing, let's settle for having hub-slim for now |
We observed (#2917 (comment)) many reported vulnerabiliies by container scanners that didn't seem to get fixed in the current base images
python:3.9-bullseye-slim
->debian:slim-bullseye
.With this PR we switch to
ubuntu:22.04
as a base image, and by doing that goes to no reported vulnerabilities again.build-essential
removed,--build-arg PIP_OVERRIDES=...
removed, images/hub/dependencies removed #2733mamba
, but stays withpip
andrequirements.txt
etc.It was introduced to be able to use
mamba clean
after having usedmicromamba
to install python and observing 100+ MB of things that wasn't needed.COPY
of the entire python installation from the build stage. I have not trialed the previous approach where the build-stage builds wheels and the final stages mounts the wheels and installs using them. I'd like to compare the approaches practically, but its more work than I'm willing to trial myself atm.Ping me if I should extract this as a dedicated PR and I'll do the work.
Results
Conclusion
ubuntu
mean longer build times, larger size, little to no reported vulnerabilities.slim
stage seems like a pure win pretty muchMy inclination is that we should go with
ubuntu
and aslim
version.