-
Notifications
You must be signed in to change notification settings - Fork 147
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
Reduce the size of Akri's Containers #491
Comments
@kate-goldenring I'd be happy to start taking a look at this! |
Great @adithyaj, I'll go ahead and assign you to it. Thes docs should help with understanding how to build the containers. I think it may be good to look at what our cross-build containers are doing. @bfjelds, you have more background than me on our builds if you have any pointers to add. |
I'm looking to see if there are any preferable alternatives to docker-slim as it does an analysis of what we do with the agent and tries to minify the image. The docker image it produced on my end uses a tarball and unpacks the specific directories before running which raises two potential issues:
We are using debian:buster-slim as the base image which is about 70MB so maybe an alternative to minimize that further could work (ex: use debian:stable-slim to reduce it to 35MB base and continue) |
What is docker-slim doing to get down to 32MB? It looks like the crictl and agent binaries are 27MB and 26MB respectively. |
We could rerun the dockerslim scenario and try to inspect the layers of the resultant image |
@adithyaj any updates on this? |
Sorry - slowed down on this while working I was on a few other things. I'll prioritize this more now. @agracey - That's a good question, last I checked it just compressed the binaries and had a few other dependencies running, I'll bring up that image and see what else it does. |
@adithyaj any chance we'd have this in for the next release? Would be nice to have smaller containers for it |
would be great to update from buster (Debian 10) to at least bullseye (Debian 11) as bullseye is now the stable release (since 1 year and a half) and bookworm (Debian 12) is coming in the coming weeks |
@kate-goldenring I am currently looking into the issue. I was thinking that maybe using alpine as the base image might help reducing the image size. Just wanted to check if you tried using alpine and faced any challenges. If not, then I can do a small POC to validate. |
From my experience, it's never a good idea to go the Alpine way for these kind of images, poor package management, no DNS over TCP support, poor ecosystem. |
FWIW, SUSE maintains full open source, free to use and distribute base images: https://registry.suse.com/ We have a few different sizes of "base" image depending on how minimized you need. We also keep them up to date and are on the embargo list for CVEs to be able to release patches along with CVE publication. |
While trying other ways of building akri (i.e ways to not use cross, cf slack), I created some images, I got the agent's image down to 57MB (might be possible to get it even slimmer). For the details I got OBS to build RPMs for akri, then I created an image containing that RPM and its dependencies. |
Issue has been automatically marked as stale due to inactivity for 90 days. Update the issue to remove label, otherwise it will be automatically closed. |
Akri's containers are heavily bloated and can be slimmed down in size. An investigation should be done into Akri's Docker files and build system to make this reduction.
For example, the Akri agent (
v0.8.16
) can be slimmed down from 159MB to 32MB using docker-slim. This shows that there should be a way to optimize our builds:Walk through of how dockerslim reduces Akri container image sizes:
docker pull ghcr.io/project-akri/akri/agent:v0.8.16-dev
docker image ls | grep akri/agent
docker-slim build --http-probe=false ghcr.io/project-akri/akri/agent:v0.8.16-dev
docker ls | grep akri/agent
Never
so it uses the local image. If usingcontainerd
instead of Docker, you may need to load the image into thecontainerd
namespace. See the note on K3s for more details.The text was updated successfully, but these errors were encountered: