Simplify adopting `chisel` distroless base images (`static` / `base` / `cc`)

Aperta
#157 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
docker, go
Ambito
devops, tooling

Direzione di ricerca

Inizia con il comando di esempio della README di chisel, quindi esamina il rockcraft.yaml di chiselled-python indicato e le definizioni degli slice di chisel-releases. Determina se è prevista la pubblicazione di immagini in stile static, base e cc oppure un’altra semplificazione; l’issue è conclusa solo dopo aver concordato tale ambito e l’approccio supportato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary:

Multiple Canonical/Ubuntu resources refer to minimal image sizes while comparing to Google distroless image size.

  • There are no equivalent images presently published for use?
  • Proper recreation requires more effort and technical confidence from the user. More verbose and fragile than some published rocks?
  • No package/slice that could simplify creation? (along with an official 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 use chisel to create a minimal image like the Google distroless ones offer.

Image from guide (click to view)

image

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

https://ubuntu.com/containers/chiselled

image

https://ubuntu.com/blog/combining-distroless-and-ubuntu-chiselled-containers

image

https://canonical.com/blog/chiselled-ubuntu-ga

image


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, and ca-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?:

# `chisel` lacks the ability to create the `--root` dir for you when it doesn't exist:
mkdir /rootfs

# Produces 40MB output:
# - `ubuntu/python:3.12-24.04_stable` image appears to roughly match contents of these slices, but is 48MB in size.
# - Missing `pebble` binary (8MB) and the `/etc/{passwd,group,localtime}` files.
chisel cut --release ubuntu-24.04 --root /rootfs \
  python3.12_standard \
  tzdata_zoneinfo \
  ca-certificates_data-with-certs \
  openssl_config \
  base-files_base

EDIT: I found the actual rockcraft.yaml used to build ubuntu/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)

Lingua principale
Go
Stelle
434
Fork
74
Merge medio
1g 30m
PR unite (30g)
1

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di canonical/chisel

Tutte le issue di canonical/chisel

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.