Skip to content

Package Registry

imglife uses a Package Registry as a lightweight database for usage records: the inventory of the images each project uses, published by imglife scan --register. imglife then queries this data to generate status reports, protect used tags from cleanup and answer questions like:

  • Which projects still use bases/alpine:3.19?
  • Which projects use an image that is not provided by imglife?
  • Which projects have not been scanned for months?

imglife supports three backends, all accessed through the same interface:

Provider Implementation Use case
GitLab GitLab Generic Package Registry Default; works with self-hosted and GitLab.com
Gitea Gitea Generic Package Registry Gitea self-hosted instances
S3 AWS S3 or any S3-compatible storage Air-gapped, MinIO, Garage, Cloudflare R2, etc.

Configure the provider in the registry: section of your imglife.yaml.

Each project owns one record, usage.json, in the package <group>--<project>, version latest. Every scan overwrites it:

{
"project": "myteam/myservice",
"ref": "1.2.0",
"revision": "a3f8b1c",
"scanned_at": "2026-10-29T10:00:00Z",
"images": [
{
"ref": "registry.example.com/bases/alpine:3.21.3-core1.0.0",
"kind": "base",
"sources": ["Dockerfile:2"],
"status": "ok"
},
{
"ref": "docker:26-dind",
"kind": "unmanaged",
"sources": [".gitlab-ci.yml:51"]
}
],
"produces": [{ "image": "registry.example.com/apps/myservice:1.2.0" }],
"custom": { "team": "backend" }
}

See imglife scan for every field.

In the project pipeline:

Terminal window
imglife scan --register --produces "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"

The project path, ref, revision and URL are read from the GitLab CI_* variables.

Terminal window
imglife app list

Records of deleted projects stay until purged. imglife app purge asks the forge whether each project still exists and removes the records of the projects it no longer finds — a project that is simply not rescanned is kept:

Terminal window
imglife app purge --dry-run # preview
imglife app purge # apply

Relationship with imglife cleanup: cleanup reads all surviving usage records to determine which base and mirror tags are still used — those tags are protected from deletion even if they are old. Running app purge before cleanup in the same pipeline lets cleanup immediately free the tags that were only used by the deleted projects.

See imglife app for details.

When you run imglife status, imglife:

  1. Lists the mirror and base images declared in sync: and build:.
  2. Downloads every usage record from the Package Registry.
  3. Re-evaluates the lifecycle of each base and mirror image used by the projects.
  4. Renders one row per project, worst status first, and the list of unmanaged images.
registry:
url: https://gitlab.example.com
project_id: 42 #
api_url: https://gitlab.com # only needed for gitlab.com

Credentials: GITLAB_TOKEN with read_packages, write_packages scopes.