|
| 1 | +# snapshotter |
| 2 | + |
| 3 | +## Building an esgz Formatted Image |
| 4 | + |
| 5 | +The demux snapshotter uses a publicly available [eStargz](https://github.com/containerd/stargz-snapshotter/blob/main/docs/estargz.md) formatted image in its integration testing pipeline. |
| 6 | +This image has the reference `ghcr.io/firecracker-microvm/firecracker-containerd/amazonlinux:latest-esgz`. |
| 7 | + |
| 8 | +### Optimize an Amazon Linux Container Image for esgz |
| 9 | + |
| 10 | +The `ctr-remote` binary is needed to optimize an image for the esgz image format. Building the stargz-snapshotter submodule provides `ctr-remote`, a `ctr` wrapper, in `_submodules/stargz-snapshotter/out/ctr-remote`. |
| 11 | +Refer to the [containerd stargz-snapshotter documentation on `ctr-remote`](https://github.com/containerd/stargz-snapshotter/blob/main/docs/ctr-remote.md) for additional details. |
| 12 | + |
| 13 | +The root level Makefile provides `make esgz-test-image` for pulling the latest Amazon Linux image locally and optimizing it for eStargz using `ctr-remote` into an image `ghcr.io/firecracker-microvm/firecracker-containerd/amazonlinux:latest-esgz`. |
| 14 | +Code owners of `firecracker-containerd` then push the eStargz optimized image as this publicly available reference using `make push-esgz-test-image` with proper credential environment variables `GH_USER` and `GH_PERSONAL_ACCESS_TOKEN` set. |
| 15 | + |
| 16 | +### Example optimization and push to GHCR |
| 17 | + |
| 18 | +Using default base and esgz images: |
| 19 | + |
| 20 | +```bash |
| 21 | +$ make esgz-test-image |
| 22 | +$ GH_USER=xxx |
| 23 | +# set GH_PERSONAL_ACCESS_TOKEN with command substitution such that it does not show in shell history |
| 24 | +$ make \ |
| 25 | + GH_USER=$GH_USER \ |
| 26 | + GH_PERSONAL_ACCESS_TOKEN=`cat` |
| 27 | + push-esgz-test-image |
| 28 | +# enter personal access token and CTRL^D |
| 29 | +``` |
| 30 | + |
| 31 | +To pull, convert, and push to a repo where the user has permissions with custom base and esgz images: |
| 32 | + |
| 33 | +```bash |
| 34 | +$ DEFAULT_BASE_IMAGE=public.ecr.aws/amazonlinux/amazonlinux:2022 |
| 35 | +$ DEFAULT_ESGZ_IMAGE=ghcr.io/$DESTINATION_REPO/amazonlinux:2022-esgz |
| 36 | +$ make \ |
| 37 | + DEFAULT_BASE_IMAGE=$DEFAULT_BASE_IMAGE \ |
| 38 | + DEFAULT_ESGZ_IMAGE=$DEFAULT_ESGZ_IMAGE \ |
| 39 | + esgz-test-image |
| 40 | +$ GH_USER=xxx |
| 41 | +# set GH_PERSONAL_ACCESS_TOKEN with command substitution such that it does not show in shell history |
| 42 | +$ make \ |
| 43 | + GH_USER=$GH_USER \ |
| 44 | + GH_PERSONAL_ACCESS_TOKEN=`cat` |
| 45 | + DEFAULT_ESGZ_IMAGE=$DEFAULT_ESGZ_IMAGE \ |
| 46 | + push-esgz-test-image |
| 47 | +# enter personal access token and CTRL^D |
| 48 | +``` |
| 49 | + |
0 commit comments