-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[build] use debian slim docker images #19008
base: master
Are you sure you want to change the base?
Conversation
For reproducible builds it's probably necessary to generate sha hashes in |
PR builds failed because of this:
Maybe you can add debian slim images to your mirror? |
@liushilongbuaa , can you help on this? |
@Staphylo , can you check this? the pr looks fine for me. |
I can help fix current error. |
Looks good to me, I did test this as well and didn't run into any issues |
I think it's also necessary to add debian slim images for arm64 and armhf.
|
Added. I will rerun failure jobs. |
It's required for bookworm images too. Also after merging this PR is necessary to update docker versions in https://github.com/sonic-net/sonic-buildimage/blob/master/files/build/versions/default/versions-docker for reproducible builds. |
Why I did it
To reduce final image size and docker images size.
Almost all SONiC docker images are based on debian image.
But default debian image includes multiple extra files that are normally not necessary within containers:
https://github.com/debuerreotype/debuerreotype/blob/master/scripts/.slimify-excludes
We are trying to remove them from debian image but this solution is incorrect.
It's not possible to remove these files from docker base layer because
--squash
only works with NEW layers:https://docs.docker.com/reference/cli/docker/image/build/#squash:
"Once the image is built, this flag squashes the new layers into a new image with a single new layer. Squashing doesn't destroy any existing image, rather it creates a new image with the content of the squashed layers."
Instead we should use debian -slim images.
Work item tracking
How I did it
Use debian slim image as base image for docker-base-bookworm, docker-base-bullseye and docker-base-buster.
How to verify it
default build:
build based on slim images:
Size of final image is reduced by 40M (20M for bookworm-based containers and 20M for bullseye-based).
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)