-
Notifications
You must be signed in to change notification settings - Fork 47
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
Simplify adopting chisel
distroless base images (static
/ base
/ cc
)
#157
Comments
Side-by-side comparisonThe promotional images that compare chiselled Ubuntu images to the Google distroless images do vary in size comparisons. Out of curiosity I have compared ( # Context: These are all presently published as `-debian12` base images:
REPOSITORY TAG IMAGE ID CREATED SIZE
gcr.io/distroless/static latest 1d74083b745f N/A 1.99MB
gcr.io/distroless/base-nossl latest 54dce73e4eb1 N/A 14.8MB
gcr.io/distroless/base latest 7273f3276b21 N/A 20.7MB
gcr.io/distroless/cc latest fb8acc0b7e50 N/A 23.4MB With # Images built with chisel v0.10.0 + Ubuntu 24.04:
REPOSITORY TAG IMAGE ID CREATED SIZE
local/chisel static 98514ef8cb5b 1 minute ago 944kB
local/chisel base-nossl 75d90a550dcb 1 minute ago 14MB
local/chisel base e994b20f5619 1 minute ago 20.2MB
local/chisel cc bffc85cf0b9f 1 minute ago 23.4MB The slight size advantage with I think the promotional material was not exactly doing a 1:1 parity comparison, but perhaps trying to show off the extra flexibility
Building
|
Producing these types of low-level images is more verbose and requires extra effort vs the published ones for language runtimes or services. Would be nice to simplify that.
Feature Request:
|
@polarathene Thanks for your comments here, it was very insightful. Apologies for taking this long but I was going through them now and I see a couple of different ideas that would be good additions for Chisel:
We'll need to study all of them separately because they all require different levels of effort. I can tell you that for sure we are going to devote time during the next months to improve the UX and vastly revamp the user documentation, which can include some of your suggestions. Presently we are working on improving the UX for slice creation, so the items that we choose to pursue from the above might take some extra time. Lastly, pull requests are welcomed, especially for simple improvements that do not require a lot of discussion. |
I did put together a slice definition for these a while back, but ran into an issue where I couldn't use If you'd like I can open a PR, it was about 2 months ago but I had this:
package: base-distroless
slices:
# Approx 1MB
static:
essential:
- base-files_base
- base-files_release-info
# NOTE: Ideally this would instead only represent root + non-root users like in Distroless?
- base-passwd_data
- libc-bin_nsswitch
- netbase_config
- ca-certificates_data
- tzdata_zoneinfo
# Approx 14MB
base-nossl:
essential:
- base-distroless_static
- libc6_libs
- libc6_gconv
- libc6_config
# Approx 20MB
base:
essential:
- base-distroless_base-nossl
- libssl3t64_libs
# Approx 24MB
cc:
essential:
- base-distroless_base
- libgomp1_libs
- libstdc++6_libs
- libgcc-s1_libs I'm not sure if it makes sense to match Google Distroless with those names, or to have them as an alias for names that would be more fitting to chisel? With that SDF one can more easily use chisel to get the equivalent Google Distroless image and add whatever other slices are needed, throw in Pebble for the entrypoint if multiple services in an image are required, etc. I think the lack of that SDF being available is the bigger friction point to resolve right now for adopting chisel for base images since I can't easily get maintainers of projects onboard when they're presented a Dockerfile with a large list of slices to maintain which presents as more complexity vs alternatives 😓 |
I think the distroless slice is the most controversial one here :), apologies for not saying that earlier. Right now slices are functional units of a package and this will be deviating a bit from that, plus I am not sure we want to track the concept of google distroless this way. I think a better solution would involve the other part of your comment about |
Summary:
Multiple Canonical/Ubuntu resources refer to minimal image sizes while comparing to Google distroless image size.
chisel
image published)Are these intentionally not published for some reason? Or are there plans to simplify producing such?
In this Jan 2023 guide (prior to the Nov 2023 General Availability announcement), the first step is to build
chisel
. The 2nd step was then to usechisel
to create a minimal image like the Google distroless ones offer.Image from guide (click to view)
This page shows some comparisions to promote
chisel
, comparing to published rocks that are available on DockerHub for services and language runtimes, but this last one about a minimal equivalent image suitable for Go and Rust projects is nowhere to be found:Images from online resources
The benefits of that minimal base are shown above, and it's useful for projects that just need to have basic deps like glibc with
/etc/passwd
+/etc/group
, andca-certificates
, possibly TZ data.I don't recall from the various resources I came across, any explanation for why chiseled images are produced for some services and language runtimes, but not these minimal glibc / distroless base image referenced above?
The project README does seem to suggest getting
chisel
and demonstrating an example which is simple enough. But I'd assume that's not too different for the published images? (like this using this Python3.12 slice)Recreating the Python rock with
chisel
I think the Python image might look something like this?:
EDIT: I found the actual
rockcraft.yaml
used to buildubuntu/python:3.12-24.04_stable
(it'd be nice if the DockerHub image README referenced that btw! I wasn't sure where or what the build source was for a while until I learned more about "rocks"). It seems I was reasonably close at guessing it's internals 😎 (this will be easier to derive once that manifest feature arrives I assume)lib6_libs
orlibgcc_s-1
like therockcraft.yaml
has explicitly, those are brought in from the dependency chain, similar to how therockcraft.yaml
brings intzdata_zoneinfo
from an implicit python dep.rockcraft.yaml
was last modified Aug 7 where it's slice forca-certificates_data
was reverted upstream on Aug 12 to what wasca-certificates_data-with-certs
. Thus building that rock at present will not match the current published image, and that's why I assumedca-certificates_data-with-certs
based on the content (no clue if the Python rock image actually requires the extra data from that slice).The text was updated successfully, but these errors were encountered: