Quick Start
This guide walks you through a minimal but real-world configuration: mirror one public image, build one base image, and generate a status report.
What you need
Section titled “What you need”- imglife installed
- A private OCI registry (e.g.
registry.example.com) - A GitLab project or Gitea organisation to store build metadata (the Package Registry)
- A
GITLAB_TOKENorGITEA_TOKENexported in your shell
Step 1 — Create the config file
Section titled “Step 1 — Create the config file”Create imglife.yaml in your base-images repository:
# imglife.yaml — base images project (GitLab)
registry: url: https://gitlab.example.com # your GitLab instance project_id: 42 # Settings > General > Project ID
sync: entries: - source: docker.io/library/alpine tag_regex: '^3\.\d+\.\d+$' # match all 3.x.y tags keep_last: 3 # keep the 3 most recent target: registry.example.com/mirrors/alpine
build: core_version: "1.0.0" registry: registry.example.com/bases images: - name: alpine folder: images/alpine type: core mirror_image: registry.example.com/mirrors/alpine mirror_tag: "3.21.3" # pinned mirror tag to use as FROM version: "3.21.3"
retention: keep_last: 5 max_age_days: 90
status: {}# imglife.yaml — base images project (Gitea)
registry: provider: gitea url: https://gitea.example.com owner: myorg repo: base-images
sync: entries: - source: docker.io/library/alpine tag_regex: '^3\.\d+\.\d+$' keep_last: 3 target: registry.example.com/mirrors/alpine
build: core_version: "1.0.0" registry: registry.example.com/bases images: - name: alpine folder: images/alpine type: core mirror_image: registry.example.com/mirrors/alpine mirror_tag: "3.21.3" version: "3.21.3"
retention: keep_last: 5 max_age_days: 90
status: {}Step 2 — Create the Dockerfile template
Section titled “Step 2 — Create the Dockerfile template”imglife uses Go templates to generate Dockerfiles. Create the folder referenced in the config:
mkdir -p images/alpineCreate images/alpine/Dockerfile.tmpl:
ARG MIRROR_IMAGEFROM ${MIRROR_IMAGE}
# Org-standard packages and configurationRUN apk add --no-cache ca-certificates tzdata curl
# OCI labels are injected automatically by imglife buildStep 3 — Export credentials
Section titled “Step 3 — Export credentials”# Package Registry (GitLab or Gitea)export GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
# OCI registry (if not using Docker CLI login)export IMGLIFE_REGISTRY_EXAMPLE_COM_USERNAME=myuserexport IMGLIFE_REGISTRY_EXAMPLE_COM_PASSWORD=mypasswordSee Credentials for the full naming convention.
Step 4 — Sync mirrors
Section titled “Step 4 — Sync mirrors”imglife syncimglife queries Docker Hub for all 3.x.y tags of alpine, resolves the 3 most recent, and copies them to your private registry.
Preview without writing anything:
imglife sync --dry-runimglife sync --list # show what would be syncedStep 5 — Build the base image
Section titled “Step 5 — Build the base image”imglife buildimglife renders images/alpine/Dockerfile.tmpl, injects OCI labels (build date, git revision, base image reference), and pushes the resulting image as registry.example.com/bases/alpine:3.21.3-core1.0.0.
The tag format is <mirror_tag>-core<core_version> by default.
Preview:
imglife build --list # show what would be builtimglife build --dry-run # render Dockerfiles without pushingStep 6 — Generate the status report
Section titled “Step 6 — Generate the status report”imglife status --output README.mdThis produces a Markdown file listing all your images with their EOL dates. Commit it to your repository so it’s visible in GitLab/Gitea.
Step 7 — Clean up stale tags
Section titled “Step 7 — Clean up stale tags”imglife cleanup --dry-run # preview what would be deletedimglife cleanup # apply retention policyAutomate with CI/CD
Section titled “Automate with CI/CD”Once you’ve verified each step locally, wire them into a CI pipeline. See the complete pipeline guides:
What’s next
Section titled “What’s next”- Connect applicative projects — once your base images are published, applicative teams can use
imglife checkto verify their base is current andimglife registerto record their builds. See App CI Integration. - Track EOL — add
lifecycle:entries to your sync config to pull EOL data from endoflife.date. See End-of-Life Tracking. - Multi-architecture — add
platforms: [linux/amd64, linux/arm64]to your build images. See build configuration.