Skip to content

sync

The sync section defines the list of upstream images to mirror.

sync:
hooks:
post_sync:
- cmd: notify-team.sh
timeout: 30s
continue_on_error: true
entries:
- source: docker.io/library/alpine
tag_regex: '^3\.\d+\.\d+$'
keep_last: 3
target: registry.example.com/mirrors/alpine
lifecycle:
product: alpine
extract: minor
FieldTypeRequiredDefaultDescription
hooks.post_sync[]HooknoCommands to run after all sync entries complete
FieldTypeRequiredDescription
sourcestringyesUpstream image reference (e.g. docker.io/library/alpine)
targetstringyesDestination image reference in your registry
tagstringone of tag/tag_regexSync a single fixed tag
tag_regexstringone of tag/tag_regexSync all tags matching this regex
keep_lastintegernoKeep only the N most recent matching tags
os_normalizeboolnoRename OS-variant tags (e.g. alpine3.211.22-alpine3.21)
check_digestboolnoRe-sync even if the tag already exists (digest check)
lifecycleLifecyclenoEOL tracking for this image
hooksHooksnoPer-entry hooks
- source: docker.io/library/alpine
tag: "3.21.3"
target: registry.example.com/mirrors/alpine

Syncs exactly one tag. Useful when you want to pin to a known-good version.

- source: docker.io/library/alpine
tag_regex: '^3\.\d+\.\d+$'
keep_last: 3
target: registry.example.com/mirrors/alpine

imglife queries Docker Hub for all tags matching the regex, sorts them by version (semantic or date fallback), and syncs the keep_last most recent. For Docker Hub images, dates are fetched in a single API call.

PatternMatches
^3\.\d+\.\d+$3.21.3, 3.20.6 — Alpine 3.x
^1\.\d+\.\d+-alpine3\.\d+$1.22.3-alpine3.21 — Go on Alpine
^\d+\.\d+$22.04, 24.04 — Ubuntu LTS
^\d+\.\d+\.\d+$Any semver

Add lifecycle tracking to connect EOL data to a sync entry:

- source: docker.io/library/alpine
tag_regex: '^3\.\d+\.\d+$'
target: registry.example.com/mirrors/alpine
lifecycle:
product: alpine # product slug on endoflife.date
extract: minor # how to derive the cycle from the tag
extract valueExample tagResolved cycle
minor3.21.33.21
major22.0422
patch1.22.11.22.1
(none)ltslts

By default imglife skips tags that already exist in the target registry. Enable check_digest: true to re-sync if the upstream digest has changed (e.g. a mutable tag like latest):

- source: docker.io/library/alpine
tag: latest
target: registry.example.com/mirrors/alpine
check_digest: true
sync:
entries:
- source: docker.io/library/alpine
tag_regex: '^3\.\d+\.\d+$'
target: registry.example.com/mirrors/alpine
hooks:
post_sync:
- cmd: curl -s https://hooks.slack.com/... -d '{"text":"alpine synced"}'
timeout: 10s
continue_on_error: true

Hooks are also available at the top level of sync: and run after all entries complete. See Hooks reference for injected environment variables.

Control how many sync entries run concurrently:

Terminal window
export IMGLIFE_SYNC_PARALLELISM=4 # default: 4

For sources that require authentication, provide credentials via environment variables using the normalised hostname:

quay.io/prometheus/prometheus
export IMGLIFE_QUAY_IO_TOKEN=mytoken
# Source: ghcr.io/owner/image
export IMGLIFE_GHCR_IO_USERNAME=myuser
export IMGLIFE_GHCR_IO_PASSWORD=mytoken

See Credentials for the full convention.