The behavior of zot registry is controlled via its configuration file, which can either be a JSON (used in details below) or YAML file.
zot serve <config-file>
A candidate configuration file can be verified via:
zot verify <config-file>
The complete machine-readable configuration reference can be generated from the same binary:
zot schema > zot-config-schema.json
The generated schema is JSON Schema draft 7. It is built from the same
configuration model used by zot verify, so it is the preferred reference for
editor integration, CI validation, and checking accepted field names.
Examples of working configurations for various use cases are available here
- Configuration Parameters
Use zot schema when you need a complete field-level reference instead of a
scenario-specific example file.
zot schema > zot-config-schema.json
zot verify config.json
The schema output includes nested options for storage drivers, authentication, authorization, extensions, sync, events, retention, and clustering. It also includes supported field aliases where the config loader accepts them.
| Key | Type | Purpose |
|---|---|---|
distSpecVersion |
string | Distribution spec version declared by the config. zot warns if it differs from the supported version and then uses the supported version. |
storage |
object | Registry storage root, dedupe, hydrate blob on read, garbage collection, retention, storage drivers, cache drivers, and repository subpaths. |
http |
object | Listener address and port, TLS, authentication, authorization, CORS, rate limits, realm, and client compatibility settings. |
log |
object | Log level, primary log output, and audit log output. |
extensions |
object | Optional sync, search, UI, metrics, scrub, lint, image trust, API key, management, and event-recorder settings. |
scheduler |
object | Background task scheduler settings such as worker count. |
cluster |
object | Scale-out members, cluster hash key, and cluster TLS settings. |
goVersion, commit, releaseTag, binaryType |
string | Build metadata fields populated by zot; they are not normally set in user configuration files. |
The sections below describe the most common settings and point to working example files for complete configurations.
Configure network params with:
"http": {
Configure address and port to listen on with:
"address": "127.0.0.1",
"port": "5000",
Additionally, TLS configuration can be specified with:
"tls": {
"cert":"test/data/server.cert",
"key":"test/data/server.key"
},
Configure storage with:
"storage": {
Configure storage root directory with:
"rootDirectory": "/tmp/zot",
Often, container images have shared layers and blobs and for filesystems that support hard links, inline deduplication can be enabled with:
"dedupe": true,
With dedupe enabled, POST /v2/<name>/blobs/uploads/?mount=<digest> can still
link a blob from this store's dedupe cache into another repository. By default,
blob reads (HEAD and ranged GET) only look at the repository-local blob
path, so a digest deleted from one repository stays missing there even if the
same digest remains in another repository or in the cache (OCI distribution-spec
AtomicDelete behavior).
To restore the older behavior where HEAD / ranged GET may materialize a
cached digest into the target repository when it is not present locally, set:
"hydrateBlobOnRead": true,
The default is false (omit the field or set it explicitly). The setting is
per store: it can be set under top-level storage or under a subPaths entry,
and it only applies within that store (not across different subPaths /
storage drivers). Explicit mounts via POST ...?mount= are unchanged.
When accessControl is enabled, both hydration and explicit mounts also require
create on the destination repository and read on at least one repository that
already holds the digest; otherwise HEAD / ranged GET stay repo-local
(StatBlob) and can still return 404 for digests missing from the destination.
A complete example is in config-hydrate-blob-on-read.json.
When an image is deleted (either by tag or reference), orphaned blobs can lead to wasted storage, and background garbage collection can be enabled with:
"gc": true,
Orphan blobs are removed if they are older than gcDelay.
"gcDelay": "2h"
On high-load registries, garbage collection can add lock contention on storage
while it runs. To restrict when a periodic GC sweep over all repositories may
start to a daily time-of-day window (e.g. only during off-peak hours), set
gcTimeWindow to a "HH:MM-HH:MM" range in UTC (start inclusive, end
exclusive) - not the server's local time zone, to keep behavior unambiguous
regardless of how the host or container is configured. A window may wrap
past midnight (e.g. "22:00-06:00"). A sweep that starts inside the window
is allowed to run to completion even past the window's end, so GC work stays
amortized instead of stalling mid-sweep on a large registry until the window
reopens the next day. Leaving it unset (the default) allows GC to run at any time:
"gcTimeWindow": "01:00-08:00"
gcTimeWindow is applied when periodic GC tasks are scheduled at server startup;
changing it via a config file reload updates the stored value but does not affect
already-running periodic GC tasks, so a restart is required for the change to take effect.
To limit the maximum number of repositories that can be created, set:
"maxRepos": 10
When the limit is reached, pushes that would create a new repository are rejected with HTTP 413. Pushes to existing repositories are always allowed. Setting maxRepos to 0 or omitting it disables enforcement.
A repository stops counting towards the limit when it is removed from storage: immediately when its last manifest is deleted and no blobs or uploads remain, or otherwise in a garbage collection cycle once its remaining blobs pass the GC delay.
To limit the logical size of each repository, set maxRepoBytes:
"maxRepoBytes": 10737418240
The value is measured in bytes and counts the unique manifest, index, config,
and layer blobs reachable from the repository's tagged references. The same
digest is counted only once within a repository. When a manifest push would
increase the logical size beyond the limit, zot returns HTTP 413 with the
current, projected, and configured sizes in the error detail. A value of 0 or
omitting maxRepoBytes disables this enforcement. The setting can also be
configured under a matching subPaths entry and takes effect after restart.
Foreign and other non-distributable layers that are not stored locally use
their descriptor sizes for logical quota accounting.
This is a logical repository quota, not a physical disk quota. Shared physical blobs across repositories are not charged as a single-repository allocation. For deployments with multiple Zot instances sharing a metadata backend, use the existing single-writer cluster routing for repository writes; independent writers are not atomically coordinated by this quota implementation.
It is also possible to store and serve images from multiple filesystems with their own repository paths, dedupe and garbage collection settings with:
"subPaths": {
"/a": {
"rootDirectory": "/tmp/zot1",
"dedupe": true,
"gc": true
},
"/b": {
"rootDirectory": "/tmp/zot2",
"dedupe": true,
"hydrateBlobOnRead": true
},
"/c": {
"rootDirectory": "/tmp/zot3",
"dedupe": false
}
}
},
On large registries (for example a 1TB+ S3 backend with many repos), the
startup walk that reconciles metaDB with the current storage can dominate
restart time. Setting fastRestart lets zot skip that walk when the same
binary is restarted with the same storage config. After a successful walk,
zot stamps metaDB with the running binary's identity plus a fingerprint of
the storage config, so that the next startup, if the stamp matches, may skip
the walk. Any binary upgrade or storage configuration changes (for example,
dedupe/rootDirectory/subPaths) invalidates the stamp and forces a full
reparse.
Fast restart is off by default. The trade-off when enabling it is that out-of-band changes to Zot's storage will not be detected and may cause inconsistencies between the metaDB and storage. To enable it:
"storage": {
"rootDirectory": "/var/lib/registry",
"fastRestart": true
}fastRestart is a top-level storage setting; it is not honored under subPaths.
You can also force a full reparse with the --force-reparse flag to zot serve.
You can define tag retention rules that govern how many tags of a given repository to retain, or for how long to retain certain tags.
You can also define keepUntagged rules for untagged manifests, including manifests cached by digest-only pull-through requests.
There are 4 possible rules for tags:
mostRecentlyPushedCount: x - top x most recently pushed tags mostRecentlyPulledCount: x - top x most recently pulled tags pulledWithin: x hours - tags pulled in the last x hours pushedWithin: x hours - tags pushed in the last x hours
The same 4 rules can be used under keepUntagged; for digest-only cached content, pushed means cached locally at the descriptor's push timestamp.
Tagged and untagged manifests are evaluated separately, so counts in keepTags do not compete with counts in keepUntagged.
An empty keepUntagged: {} does not retain all untagged manifests; it is equivalent to omitting keepUntagged.
keepUntagged rules require the metadata database. If it is unavailable, zot ignores keepUntagged and uses the existing delay-based untagged cleanup.
If ANY of these rules are met by a tag or untagged manifest, then it will be retained, in other words there is an OR logic between them
repositories uses glob patterns tag patterns uses regex
"retention": {
"dryRun": false, // if enabled will just log the retain action without actually removing
"delay": "24h", // is applied on untagged and referrers, will remove them only if they are older than 24h
"policies": [ // a repo will match a policy if it matches any repoNames[] glob pattern, it will select the first policy it can matches
{
"repositories": ["infra/*", "prod/*"], // patterns to match
"deleteReferrers": false, // delete manifests with missing Subject (default is false)
"deleteUntagged": true, // delete untagged manifests (default is true)
"KeepTags": [{ // same as repo, the first pattern(this time regex) matched is the policy applied
"patterns": ["v2.*", ".*-prod"] // if there is no rule then the default is to retain always, this tagRetention will retain all tags matching the regexes in the patterns list.
},
{
"patterns": ["v3.*", ".*-prod"],
"pulledWithin": "168h" // will keep v3.* and .*-prod tags that are pulled within last 168h
}]
}, // all tags under infra/* and prod/* will be removed! because they don't match any retention policy
{
"repositories": ["tmp/**"], // matches recursively all repos under tmp/
"deleteReferrers": true,
"deleteUntagged": true,
"KeepTags": [{ // will retain all tags starting with v1 and pulled within the last 168h
"patterns": ["v1.*"], // all the other tags will be removed
"pulledWithin": "168h",
"pushedWithin": "168h"
}],
"keepUntagged": { // untagged manifests pulled or cached locally within the last 168h are retained
"pulledWithin": "168h",
"pushedWithin": "168h"
}
},
{
"repositories": ["**"],
"deleteReferrers": true,
"deleteUntagged": true,
"keepTags": [{
"mostRecentlyPushedCount": 10, // top 10 recently pushed tags
"mostRecentlyPulledCount": 10, // top 10 recently pulled tags
"pulledWithin": "720h",
"pushedWithin": "720h"
}],
"keepUntagged": {
"mostRecentlyPushedCount": 10, // top 10 recently cached/pushed untagged manifests
"mostRecentlyPulledCount": 10, // top 10 recently pulled untagged manifests
"pulledWithin": "720h",
"pushedWithin": "720h"
}
}
]
}
If a repo doesn't match any policy, then that repo and all its tags are retained. (default is to not delete anything)
If keepTags is empty, then all tags are retained (default is to retain all tags)
If we have at least one tagRetention policy in the tagRetention list then all tags that don't match at least one of them will be removed!
deleteUntagged remains the master switch for untagged manifests. When deleteUntagged is true and keepUntagged is configured, untagged manifests that fail keepUntagged rules still honor the configured retention delay before deletion. Without keepUntagged, untagged manifests keep the existing delay-based cleanup behavior.
For safety purpose you can have a default policy as the last policy in list, all tags that don't match the above policies will be retained by this one:
"keepTags": [
{
"patterns": [".*"] // will retain all tags
}
}]
TLS mutual authentication and passphrase-based authentication are supported. For deployments that enable more than one authentication method, see Combined Authentication.
Apart from the server cert and key specified under network configuration, specifying the cacert field enables TLS mutual authentication:
"http": {
"tls": {
"cert":"test/data/server.cert",
"key":"test/data/server.key",
"cacert":"test/data/cacert.cert"
},
By default, mTLS authentication extracts the client identity from the certificate's
Common Name (CN) field. You can configure alternative identity attributes and a fallback
chain using the mtls configuration under auth:
"http": {
"auth": {
"mtls": {
"identityAttributes": ["CommonName", "Subject", "Email", "URI", "DNSName"],
"uriSanPattern": "spiffe://example.org/workload/(.*)",
"uriSanIndex": 0,
"dnsSanIndex": 0,
"emailSanIndex": 0
}
}
}
Identity Attributes:
CommonNameorCN- Extract identity from the certificate's Common Name (CN) field (default)SubjectorDN- Extract identity from the full Subject Distinguished Name (DN)Emailorrfc822name- Extract identity from Email SAN (Subject Alternative Name)URIorURL- Extract identity from URI SAN (Subject Alternative Name)DNSNameorDNS- Extract identity from DNS SAN (Subject Alternative Name)
The identityAttributes array defines a fallback chain - if the first identity attribute fails to
extract an identity, the next identity attribute is tried, and so on. All identity attribute
names are case-insensitive.
URI SAN Pattern:
When using URI as an identity attribute, you can specify a regex pattern to extract
a specific part of the URI. For example, with SPIFFE certificates:
- URI:
spiffe://example.org/workload/testuser - Pattern:
spiffe://example.org/workload/(.*) - Extracted identity:
testuser
If no pattern is specified, the full URI value is used as the identity.
SAN Indexes: When multiple values exist in a SAN field (URI, DNS, or Email), you can specify which one to use with the index fields (0-based). Default is 0 (first value).
Example Configurations:
- Basic mTLS with CommonName:
examples/config-mtls.json - SPIFFE with URI SAN pattern:
examples/config-mtls-spiffe.json
Local authentication is supported via htpasswd file with:
"http": {
"auth": {
"htpasswd": {
"path": "test/data/htpasswd"
},
LDAP authentication can be configured with:
"http": {
"auth": {
"ldap": {
"address":"ldap.example.org",
"port":389,
"startTLS":false,
"baseDN":"ou=Users,dc=example,dc=org",
"userAttribute":"uid",
"credentialsFile": "config-ldap-credentials.json",
"skipVerify":false,
"subtreeSearch":true
},
NOTE: When both htpasswd and LDAP configuration are specified, LDAP authentication is given preference.
NOTE: The separate file for storing DN and password credentials must be created. You can see example in examples/config-ldap-credentials.json file.
OAuth2 authentication (client credentials grant type) support via Bearer Token configured with:
"http": {
"auth": {
"bearer": {
"realm": "https://auth.myreg.io/auth/token",
"service": "myauth",
"cert": "/etc/zot/auth.crt"
}
When OIDC workload identity/federation uses Zot /zot/auth/token but the same deployment still needs this traditional bearer token service, configure the optional upstreamTokenEndpoint object. upstreamTokenEndpoint.realm points to the existing traditional bearer token service and upstreamTokenEndpoint.service is the upstream service value; Zot preserves the token request and rewrites only service before proxying requests that are not owned by local token backends. upstreamTokenEndpoint.realm must use HTTPS by default; plaintext HTTP requires upstreamTokenEndpoint.allowInsecureHttp: true and should only be used in controlled test environments.
zot supports several openID/OAuth2 providers:
- github
- gitlab
- dex
For OIDC providers (those configured with an issuer) zot accepts the ID token signing algorithms
advertised in the issuer's discovery document (id_token_signing_alg_values_supported), for example RS256,
ES256, PS256 or PS512.
zot can be configured to use the above providers with:
{
"http": {
"address": "127.0.0.1",
"port": "8080",
"auth": {
"openid": {
"providers": {
"github": {
"clientid": <client_id>,
"clientsecret": <client_secret>,
"scopes": ["read:org", "user", "repo"]
},
"google": {
"issuer": "https://accounts.google.com",
"clientid": <client_id>,
"clientsecret": <client_secret>,
"scopes": ["openid", "email"]
},
"gitlab": {
"issuer": "https://gitlab.com",
"clientid": <client_id>,
"clientsecret": <client_secret>,
"scopes": ["openid", "read_api", "read_user", "profile", "email"]
}
}
}
}
}
To login with either provider use http://127.0.0.1:8080/zot/auth/login?provider=\<provider>&callback_ui=/home for example to login with github use http://127.0.0.1:8080/zot/auth/login?provider=github&callback_ui=/home
callback_ui query parameter is used by zot to redirect to UI after a successful openid/oauth2 authentication
OpenID Connect providers are initialized lazily, on the first login attempt, so zot startup does not depend on
the provider issuer being reachable. While the issuer is unreachable, the login and callback endpoints of that
provider respond with 503 Service Unavailable and initialization is retried on the next attempt; other
authentication methods (htpasswd, LDAP, API keys) and registry operations keep working.
By default, callback_ui must be a relative path (starting with /) to prevent open redirects.
If your UI runs on a different origin (e.g. different port during development), you can allowlist
absolute redirect origins via:
{
"http": {
"auth": {
"openid": {
"callbackAllowOrigins": ["http://127.0.0.1:3000"]
}
}
}
}
The callback url which should be used when making oauth2 provider setup is http://127.0.0.1:8080/zot/auth/callback/\<provider> for example github callback url would be http://127.0.0.1:8080/zot/auth/callback/github
If network policy doesn't allow inbound connections, this callback won't work!
When authenticating with the GitHub provider, if you include the read:org scope, zot will fetch both the user's Organization memberships and their Team memberships.
Team memberships are formatted as <organization>/<team-slug> and added to the user's groups. You can use these in your access control policies. For example, if a user belongs to the Infra team in the myorg organization, the group name will be myorg/infra.
Group strings preserve GitHub-provided login/slug casing (no lowercasing is applied), so policy group values must match that exact casing.
{
"accessControl": {
"repositories": {
"myorg/infrastructure/**": {
"policies": [
{
"groups": ["myorg/infra"],
"actions": ["read", "create", "update", "delete"]
}
]
}
}
}
}dex is an identity service that uses OpenID Connect to drive authentication for other apps https://github.com/dexidp/dex To setup dex service see https://dexidp.io/docs/getting-started/
To configure zot as a client in dex (assuming zot is hosted at 127.0.0.1:8080), we need to configure dex with:
staticClients:
- id: zot-client
redirectURIs:
- 'http://127.0.0.1:8080/zot/auth/callback/oidc'
name: 'zot'
secret: ZXhhbXBsZS1hcHAtc2VjcmV0
zot can be configured to use dex with:
"http": {
"auth": {
"openid": {
"providers": {
"oidc": {
"name": "Corporate SSO",
"clientid": "zot-client",
"clientsecret": "ZXhhbXBsZS1hcHAtc2VjcmV0",
"keypath": "",
"issuer": "http://127.0.0.1:5556/dex",
"scopes": ["openid", "profile", "email", "groups"],
"claimMapping": {
"username": "preferred_username",
"groups": "groups"
}
}
}
}
}
}
To login using openid dex provider use http://127.0.0.1:8080/zot/auth/login?provider=oidc
claimMapping.username defaults to email, and claimMapping.groups defaults to groups.
zot fetches the discovery document from <issuer>/.well-known/openid-configuration. If zot cannot reach the
issuer's public URL, for example when the identity provider runs in the same cluster behind a gateway that
blocks internal traffic, set discoveryurl to the full URL of the discovery document on an address zot can reach:
"oidc": {
"issuer": "https://auth.example.com/realms/zot",
"discoveryurl": "http://keycloak.auth.svc:8080/realms/zot/.well-known/openid-configuration",
...
}
The issuer in the fetched document must still equal the configured issuer. zot also calls the token, JWKS and
userinfo endpoints listed in that document, so they must be reachable from zot as well. Keycloak, for example,
lists internal URLs for these when hostname-backchannel-dynamic is enabled.
NOTE: Social login is not supported by command line tools, or other software responsible for pushing/pulling images to/from zot. Given this limitation, if openif authentication is enabled in the configuration, API keys are also enabled implicitly, as a viable alternative authentication method for pushing and pulling container images.
In the case of running zot with openid enabled behind a proxy/load balancer http.externalUrl should be provided.
"http": {
"address": "0.0.0.0",
"port": "8080",
"externalUrl": "https://zot.example.com",
"auth": {
"openid": {
"providers": {
"github": {
"clientid": <client_id>,
"clientsecret": <client_secret>,
"scopes": ["read:org", "user", "repo"]
}
}
}
}
}
This config value will be used by oauth2/openid clients to redirect back to zot.
- GitHub Enterprise Server (on-premises GitHub)
- GitLab Self-Managed instances
- Custom corporate OAuth2/OIDC providers
When integrating zot with self-hosted OAuth2 providers like GitHub Enterprise Server, GitLab Self-Managed, or custom OIDC implementations, you must specify custom authentication and token endpoints since the default public endpoints won't work.
"http": {
"address": "0.0.0.0",
"port": "8080",
"externalUrl": "https://zot.example.com",
"auth": {
"openid": {
"providers": {
"github": {
"clientid": <client_id>,
"clientsecret": <client_secret>,
"authurl": "https://github.company.com/login/oauth/authorize", // Custom GHE authorization endpoint
"tokenurl": "https://github.company.com/login/oauth/access_token", // Custom GHE token endpoint
"scopes": ["read:org", "user", "repo"]
}
}
}
}
}
Without authurl/tokenurl, zot assumes public GitHub.com endpoints.
Whenever a user logs in zot using any of the auth options available(basic auth/openid) zot will set a 'session' cookie on its response. Using that cookie on subsequent calls will authenticate them, asumming the cookie didn't expire.
In case of using filesystem storage sessions are saved in zot's root directory. In case of using cloud storage sessions are saved in memory.
Note: By default, the session driver config would be local for file system or in-memory. The session driver name for this is local. An example config is shown below, but the config can be omitted as it is a default.
"auth": {
"htpasswd": {
"path": "test/data/htpasswd"
},
"sessionDriver": {
"name": "local"
}
}
Note: This sessionDriver config is optional if a local session storage is desired.
Redis and Redis-compatible storage drivers can also be used for cases where session storage is required to be kept separately from zot or multiple zot instances need to share the session information.
This can be configured in the auth section of the configuration as shown below:
sessionDriver
"auth": {
"htpasswd": {
"path": "test/data/htpasswd"
},
"sessionDriver": {
"name": "redis",
"url": "redis://localhost:6379",
"keyprefix": "zotsession"
}
}
The redis driver configuration options are the same as those in the Redis Cache Driver section. If the redis session driver is being used along with a redis cache driver and both configurations point to the same Redis instance, there will be two independent connections used.
Note: The redis session driver cannot be specified along with configuration for the SessionKeysFile.
In order to secure session cookies used in session based authentication process you need to set the path to a file containing keys used to hash and encrypt the cookies:
sessionKeysFile
"auth": {
"htpasswd": {
"path": "test/data/htpasswd"
},
"sessionKeysFile": "/home/user/keys",
"apikey": true,
}
user@host:~/zot$ cat ../keys | jq
{
"hashKey": "my-very-secret",
"encryptKey": "another-secret"
}
- hashKey - used to authenticate the cookie value using HMAC. It is recommended to use a key with exactly 32 or 64 bytes.
- encryptKey - this is optional, used to encrypt the cookie value. If set, the length must correspond to the block size of the encryption algorithm. For AES, used by default, valid lengths are 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
If at least hashKey is not set zot will create a random one which on zot restarts it will invalidate all currently valid cookies and their sessions, requiring all users to login again.
zot allows authentication for REST API calls using your API key as an alternative to your password. The user can create or revoke his API keys after he has already authenticated using a different authentication mechanism. An API key is shown to the user only when it is created. It can not be retrieved from zot with any other call. An API key has the same permissions as the user who generated it.
Below are several use cases where API keys offer advantages:
- OpenID/OAuth2 social login is not supported by command-line tools or other such clients. In this case, the user can login to zot using OpenID/OAuth2 and generate API keys to use later when pushing and pulling images.
- In cases where LDAP authentication is used and the user has scripts pushing or pulling images, he will probably not want to store his LDAP username and password in a shared environment where there is a chance they are compromised. If he generates and uses an API key instead, the security impact of that key being compromised is limited to zot, the other services he accesses based on LDAP would not be affected.
To activate API keys use:
"http": {
"auth": {
"apikey": true
}
}
To cap the lifetime of API keys, set apikeyMaxLifetime (a Go duration, like 720h):
"http": {
"auth": {
"apikey": true,
"apikeyMaxLifetime": "720h"
}
}
A key created with no expiration date, or a later one, gets the expiration date now + apikeyMaxLifetime.
A key older than apikeyMaxLifetime is refused, also if it was created before the setting.
The stored key is not changed, so raising or removing the setting makes it work again.
If not set, keys can be created without expiry.
Create an API key for the current user using the REST API
Usage: POST /zot/auth/apikey
Produces: application/json
Sample input:
POST /zot/auth/apikey
Body: {"label": "git", "scopes": ["repo1", "repo2"], "expirationDate": "2023-08-28T17:10:05+03:00"}'
The time format of expirationDate is RFC 3339.
Example cURL without expiration date
curl -u user:password -X POST http://localhost:8080/zot/auth/apikey -d '{"label": "git", "scopes": ["repo1", "repo2"]}'Sample output:
{
"createdAt": "2023-05-05T15:39:28.420926+03:00",
"expirationDate": "0001-01-01T00:00:00Z",
"isExpired": false,
"creatorUa": "curl/7.68.0",
"generatedBy": "manual",
"lastUsed": "0001-01-01T00:00:00Z",
"label": "git",
"scopes": [
"repo1",
"repo2"
],
"uuid": "46a45ce7-5d92-498a-a9cb-9654b1da3da1",
"apiKey": "zak_e77bcb9e9f634f1581756abbf9ecd269"
}Example cURL with expiration date
curl -u user:password -X POST http://localhost:8080/zot/auth/apikey -d '{"label": "myAPIKEY", "expirationDate": "2023-08-28T17:10:05+03:00"}'Sample output:
{
"createdAt":"2023-08-28T17:09:59.2603515+03:00",
"expirationDate":"2023-08-28T17:10:05+03:00",
"isExpired":false,
"creatorUa":"curl/7.68.0",
"generatedBy":"manual",
"lastUsed":"0001-01-01T00:00:00Z",
"label":"myAPIKEY",
"scopes":null,
"uuid":"c931e635-a80d-4b52-b035-6b57be5f6e74",
"apiKey":"zak_ac55a8693d6b4370a2003fa9e10b3682"
}Get list of API keys for the current user using the REST API
Usage: GET /zot/auth/apikey
Produces: application/json
Example cURL
curl -u user:password -X GET http://localhost:8080/auth/apikey Sample output:
{
"apiKeys": [
{
"createdAt": "2023-05-05T15:39:28.420926+03:00",
"expirationDate": "0001-01-01T00:00:00Z",
"isExpired": true,
"creatorUa": "curl/7.68.0",
"generatedBy": "manual",
"lastUsed": "0001-01-01T00:00:00Z",
"label": "git",
"scopes": [
"repo1",
"repo2"
],
"uuid": "46a45ce7-5d92-498a-a9cb-9654b1da3da1"
},
{
"createdAt": "2023-08-11T14:43:00.6459729+03:00",
"expirationDate": "2023-08-17T18:24:05+03:00",
"isExpired": false,
"creatorUa": "curl/7.68.0",
"generatedBy": "manual",
"lastUsed": "2023-08-11T14:43:47.5559998+03:00",
"label": "myAPIKEY",
"scopes": null,
"uuid": "294abf69-b62f-4e58-b214-dad2aec0bc52"
}
]
}Using API keys with cURL
curl -u user:zak_e77bcb9e9f634f1581756abbf9ecd269 http://localhost:8080/v2/_catalogOther command line tools will similarly accept the API key instead of a password.
How to revoke an API key for the current user
Usage: DELETE /zot/auth/apikey?id=$uuid
Produces: application/json
Example cURL
curl -u user:password -X DELETE http://localhost:8080/zot/auth/apikey?id=46a45ce7-5d92-498a-a9cb-9654b1da3da1API keys keep working until they expire or are revoked, also after the user lost access in the identity provider. An admin can revoke all API keys of a user. The keys stop working right away. The user can still log in, if the identity provider allows it, and create new keys.
Only users matching accessControl.adminPolicy, including its conditions, can do this. Other users get 403.
Without adminPolicy nobody can.
Usage: DELETE /zot/auth/apikey?username=$username
Example cURL
curl -u admin:password -X DELETE http://localhost:8080/zot/auth/apikey?username=aliceusername is the identity the user authenticates with, the same one used in accessControl, e.g. the email for OpenID.
The request succeeds also when the user has no API keys.
Should authentication fail, to prevent automated attacks, a delayed response can be configured with:
"http": {
"auth": {
"failDelay": 5
}
}
Allowing actions on one or more repository paths can be tied to user identities. Two additional per-repository policies can be specified for identities not in the whitelist:
- anonymousPolicy - applied for unauthenticated users.
- defaultPolicy - applied for authenticated users.
Furthermore, a global admin policy can also be specified which can override per-repository policies.
Glob patterns can also be used as repository paths.
Authorization is granted based on the longest path matched. For example repos2/repo repository will match both "**" and "repos2/repo" keys, in such case repos2/repo policy will be used because it's longer.
Because we use longest path matching we need a way to specify a global policy to override all the other policies. For example, we can specify a global policy with "**" (will match all repos), but any other policy will overwrite it, because it will be longer. So that's why we have the option to specify an adminPolicy.
Basically '**' means repositories not matched by any other per-repository policy.
Method-based action list:
- "read" - list/pull images
- "create" - push images (needs "read")
- "update" - overwrite tags (needs "read" and "create")
- "delete" - delete images (needs "read")
Behaviour-based action list
- "detectManifestCollision" - delete manifest by digest will throw an error if multiple manifests have the same digest (needs "read" and "delete")
"accessControl": {
"groups": { # reusable groups of users
"group1": {
"users": ["jack", "john", "jane", "ana"]
},
"group2": {
"users": ["alice", "mike", "jim"]
}
},
"repositories": { # per-repository policies
"**": { # matches all repos (which are not matched by any other per-repository policy)
"policies": [ # user based policies
{
"users": ["charlie"],
"actions": ["read", "create", "update"]
}
],
"defaultPolicy": ["read", "create", "delete", "detectManifestCollision"], # default policy which is applied for authenticated users, other than "charlie"=> so these users can read/create/delete repositories and also can detect manifests collision.
"anonymousPolicy": ["read"] # anonymous policy which is applied for unauthenticated users => so they can read repositories
},
"tmp/**": { # matches all repos under tmp/ recursively
"defaultPolicy": ["read", "create", "update"] # so all users have read/create/update on all repos under tmp/ eg: tmp/infra/repo
},
"infra/*": { # matches all repos directly under infra/ (not recursively)
"policies": [
{
"users": ["alice", "bob"],
"actions": ["create", "read", "update", "delete"]
},
{
"users": ["mallory"],
"actions": ["create", "read"]
}
],
"defaultPolicy": ["read"]
},
"repos2/repo": { # matches only repos2/repo repository
"policies": [
{
"users": ["bob"],
"groups": ["group1"],
"actions": ["read", "create"]
},
{
"users": ["mallory"],
"actions": ["create", "read"]
}
],
"defaultPolicy": ["read"]
}
},
"adminPolicy": { # global admin policy (overrides per-repo policy)
"users": ["admin"],
"actions": ["read", "create", "update", "delete"]
}
}The metrics key inside accessControl controls access to the Prometheus scrape endpoint independently of repository policies. It supports two fields:
users- list of named authenticated users allowed to scrape. Requires authentication (e.g. htpasswd) to be configured.anonymousPolicy- set to["read"]to allow unauthenticated access to the metrics endpoint when authentication is configured for other routes.
To restrict scraping to specific named users:
"accessControl": {
"metrics": {
"users": ["prometheus"]
}
}
See config-metrics-authz.json for a complete example combining htpasswd authentication with repository policies.
When authentication is configured and repositories have non-anonymous policies, anonymousPolicy on metrics allows unauthenticated scrapers to reach the metrics endpoint while keeping repository routes protected:
"http": {
"auth": {
"htpasswd": { "path": "test/data/htpasswd" }
},
"accessControl": {
"metrics": {
"anonymousPolicy": ["read"]
},
"repositories": {
"**": { "defaultPolicy": ["read", "create"] }
}
}
}
See config-metrics-authn-anonymous-access.json for a complete example.
When a dist-spec-only zot is scraped through the zxp exporter and its metrics endpoint requires authentication, give zxp its own credentials with credentialsFile in the Server section of the exporter config:
"Server": {
"protocol": "http",
"host": "127.0.0.1",
"port": "8080",
"credentialsFile": "examples/metrics/exporter/config-auth-credentials.json"
}
The file holds the username and password that zxp sends as basic auth:
{
"username": "metrics",
"password": "password"
}
When accessControl is configured on the zot server, that user must be listed in metrics.users. Without accessControl, any authenticated user can scrape.
The file is read when zxp starts, so restart it after changing the credentials. Keep it readable only by the user running zxp, and use https for the connection to zot unless both run on the same host; zxp logs a warning when the credentials go over plain http.
zxp serves the metrics it collects, which include repository names, without authentication, so restrict access to its port. See metrics/exporter/config-auth.json for a complete example.
By default, an anonymousPolicy with read also lets unauthenticated users list repositories through GET /v2/_catalog (filtered to the repositories they can read). Set disableAnonymousCatalog to true in accessControl to reject anonymous catalog requests with 401 Unauthorized:
"accessControl": {
"disableAnonymousCatalog": true,
"repositories": {
"**": { "anonymousPolicy": ["read"] }
}
}
Anonymous pulls from repositories allowed by anonymousPolicy keep working, and authenticated users can still list the catalog. The option can be changed with a config hot reload (SIGHUP). It only affects /v2/_catalog; it does not restrict the search extension's GraphQL repository listings.
See config-anonymous-catalog-disabled.json for a complete example.
Policy entries can carry an optional list of conditions: CEL boolean
expressions that must all evaluate to true for the entry to grant access.
This is the same pattern as conditional access in cloud IAM systems.
"policies": [{
"users": ["alice"],
"actions": ["read", "create", "update"],
"conditions": [{
"expression": "req.time < timestamp(\"2099-12-31T23:59:59Z\")",
"message": "alice's access expires end of 2099"
},
{
"expression": "req.referenceType == \"digest\"",
"message": "prod pushes must use digest references"
}
]
}]
Expressions evaluate against a req struct with the following fields:
| Path | Type | Description |
|---|---|---|
req.time |
timestamp | Current time as a CEL timestamp; compare with timestamp("2099-12-31T23:59:59Z"). |
req.method |
string | Raw HTTP method of the originating request ("GET", "PUT", ...). |
req.userAgent |
string | User-Agent header. |
req.action |
string | Abstract action being authorized: "read", "create", "update", "delete". Use this for action gating; req.method is the raw verb escape hatch. |
req.repository |
string | The requested repository, when known. |
req.reference |
string | Tag or digest, when the route has one. |
req.referenceType |
string | "tag", "digest", or "" when the route has no reference. |
req.tag |
string | The tag, when reference is a tag. |
req.digest |
string | The digest, when reference is a digest. |
req.user.username |
string | Authenticated username. |
req.user.groups |
list<string> | Authenticated user's groups. |
req.auth.anonymous |
bool | Convenience for req.user.username == "". |
req.auth.admin |
bool | True when the user matches the admin policy. |
req.client.ip |
string | TCP peer address from RemoteAddr (port stripped). Always trustworthy. |
req.client.forwardedFor |
list<string> | X-Forwarded-For chain, left to right. Untrusted — anyone can set the header. |
req.tls.enabled |
bool | Whether the request arrived over TLS at zot. |
req.tls.version |
string | TLS version: "1.2", "1.3", ... when applicable. |
req.claims |
map | Authn-time attribute bag, populated by the active authn flow (today: OIDC bearer fills it with the ID token claim set; other flows can feed this surface as they grow that capability). |
Network gates. req.client.ip is the TCP peer (the proxy, behind a
reverse proxy). req.client.forwardedFor is the raw header chain — useful
but spoofable, since any client can set it. The idiomatic pattern is to gate
on the chain only after asserting the TCP peer is your trusted proxy:
req.client.ip == "10.0.0.5" && req.client.forwardedFor[0].startsWith("192.0.2.")
Deny messages. When a condition evaluates to false, its message is
surfaced to the client in the 403 response body's error detail under the
reason key, and also logged for operator diagnosis. Internal lookup or
evaluation failures are not surfaced (the client just gets a generic deny)
to avoid leaking implementation issues.
The number of workers for the task scheduler has the default value of runtime.NumCPU()*4, and it is configurable with:
"scheduler": {
"numWorkers": 3
}
Enable and configure logging with:
"log":{
Set log level with:
"level":"debug",
Set output file (default is stdout) with:
"output":"/tmp/zot.log",
Enable audit logs and set output file with:
"audit": "/tmp/zot-audit.log"
}
Enable and configure metrics with:
"metrics":{
"enable":"true",
Set server path on which metrics will be exposed:
"prometheus": {
"path": "/metrics"
}
}
In order to test the Metrics feature locally in a Kind cluster, follow this guide.
Beside filesystem storage backend, zot also supports S3 storage backend, check below url to see how to configure it:
- s3 config: A driver storing objects in an Amazon Simple Storage Service (S3) bucket.
For an s3 zot configuration with multiple storage drivers see: s3-config.
zot also supports different storage drivers for each subpath.
zot supports an Azure Blob Storage backend. For a full example see azure config.
The driver requires accountname and container, and selects how to authenticate via
storageDriver.credentials.type:
shared_key— authenticate with a storage account key; setaccountkey.client_secret— authenticate as an Entra (Azure AD) service principal; settenantid,clientid, andsecret.default_credentials— use the Azure SDK'sDefaultAzureCredentialchain, so no secret is stored in the zot config. It resolves a credential in order: Azure Workload Identity (federated token), Managed Identity, theAZURE_*environment variables, then Azure CLI login. This is the recommended option when zot runs on AKS or a self-managed cluster with the Azure Workload Identity webhook — zot's pod receives a federated token and needs no stored credentials.
The example uses default_credentials (Workload Identity). DefaultAzureCredential works
wherever an ambient Azure identity is available — not only on Azure: any Kubernetes
cluster running the azure-workload-identity
webhook can federate a managed identity to zot's ServiceAccount (the cluster's OIDC issuer
trusted by Entra), including self-managed / non-Azure clusters, and zot gets a token via
the WorkloadIdentityCredential — no secrets stored. For a plain standalone process with no
managed/federated identity, default_credentials falls back to the AZURE_TENANT_ID /
AZURE_CLIENT_ID / AZURE_CLIENT_SECRET (or AZURE_CLIENT_CERTIFICATE_PATH) environment
variables or an az login session; otherwise use shared_key (with accountkey) or
client_secret (with a service principal).
Example (Workload Identity, secret-less):
"storage": {
"rootDirectory": "/tmp/zot", # local path used to store dedupe cache database
"dedupe": false,
"storageDriver": {
"name": "azure",
"rootdirectory": "/zot", # prefix applied to all blob names
"accountname": "myazurestorageaccount",
"container": "zot-storage",
"credentials": { "type": "default_credentials" }
}
}
The following AWS policy is required by zot for push and pull. Make sure to replace S3_BUCKET_NAME with the name of your bucket.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:ListBucket", "s3:GetBucketLocation", "s3:ListBucketMultipartUploads" ], "Resource": "arn:aws:s3:::S3_BUCKET_NAME" }, { "Effect": "Allow", "Action": [ "s3:PutObject", "s3:GetObject", "s3:DeleteObject", "s3:ListMultipartUploadParts", "s3:AbortMultipartUpload" ], "Resource": "arn:aws:s3:::S3_BUCKET_NAME/*" } ] }
- Config file:
"storage": {
"rootDirectory": "/tmp/zot", # local path used to store dedupe cache database
"dedupe": true,
"redirectBlobURL": true,
"storageDriver": {
"name": "s3",
"rootdirectory": "/zot", # this is a prefix that is applied to all S3 keys to allow you to segment data in your bucket if necessary.
"region": "us-east-2",
"bucket": "zot-storage",
"forcepathstyle": true,
"secure": true,
"skipverify": false,
"accesskey": "<YOUR_ACCESS_KEY_ID>",
"secretkey": "<YOUR_SECRET_ACCESS_KEY>"
}
}
Blob pull redirects are disabled by default. With S3 or GCS storage, set redirectBlobURL to true under storage or under a subPaths entry to return a 307 Temporary Redirect to the storage driver's signed URL after zot authorization. If the storage driver does not return a redirect URL, zot proxies the blob as before.
There are multiple ways to specify S3 credentials besides config file:
- Environment variables:
SDK looks for credentials in the following environment variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN (optional)
- Credentials file:
A credential file is a plaintext file that contains your access keys. The file must be on the same machine on which you’re running your application. The file must be named credentials and located in the .aws/ folder in your home directory.
[default]
aws_access_key_id = <YOUR_DEFAULT_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_DEFAULT_SECRET_ACCESS_KEY>
[test-account]
aws_access_key_id = <YOUR_TEST_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_TEST_SECRET_ACCESS_KEY>
[prod-account]
; work profile
aws_access_key_id = <YOUR_PROD_ACCESS_KEY_ID>
aws_secret_access_key = <YOUR_PROD_SECRET_ACCESS_KEY>
The [default] heading defines credentials for the default profile, which the SDK will use unless you configure it to use another profile.
To specify a profile use AWS_PROFILE environment variable:
AWS_PROFILE=test-account
For more details see https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
zot supports two types of cache drivers: boltdb which is local and dynamodb which is remote. They are used when dedupe is enabled to store duplicate blobs.
Like s3 configuration, if you don't specify a cache driver it will default to 'boltdb' and it wil be stored in zot's root directory or subpath root directory
"storage": {
"rootDirectory": "/tmp/zot",
"dedupe": true
}
boltdb can be found at /tmp/zot/cache.db
To set up a zot with dedupe enabled and dynamodb as a cache driver, "cacheDriver" field should be included under 'storage'
"storage": {
"rootDirectory": "/tmp/zot",
"dedupe": true,
"remoteCache": true,
"cacheDriver": {
"name": "dynamodb", // driver name
"endpoint": "http://localhost:4566", // aws endpoint
"region": "us-east-2" // aws region
"cacheTablename": "ZotBlobTable" // table used to store deduped blobs
}
},
Like s3 configuration AWS GO SDK will load additional config and credentials values from the environment variables, shared credentials, and shared configuration files
Additionally if search extension is enabled, additional parameters are needed:
"cacheDriver": {
"name": "dynamodb",
"endpoint": "http://localhost:4566",
"region": "us-east-2",
"cacheTablename": "ZotBlobTable",
// used for auth
"userDataTablename": "ZotUserDataTable",
"apiKeyTablename": "ZotApiKeyDataTable",
// used by search extension
"repoMetaTablename": "ZotRepoMetadataTable",
"imageMetaTablename": "ZotImageMetaTable",
"repoBlobsInfoTablename": "ZotRepoBlobsInfoTable",
"versionTablename": "ZotVersion"
}
The following AWS policy is required by zot for caching blobs. Make sure to replace DYNAMODB_TABLE with the name of your table which in our case is the value of "cacheTablename" (ZotBlobTable)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "dynamodb:CreateTable", "dynamodb:DescribeTable", "dynamodb:DeleteTable", "dynamodb:Scan", "dynamodb:BatchGetItem", "dynamodb:GetItem", "dynamodb:UpdateItem", "dynamodb:DeleteItem" ], "Resource": "arn:aws:dynamodb:::table/DYNAMODB_TABLE" } ] }
Note dynamodb:DeleteTable is used only in running the zot tests, should not be needed in production.
Redis is an alternative to BoltDB (which cannot be shared by multiple zot instances) and DynamoDB (requires access to AWS). Redis can be set up using a configuration similar to the one below:
"storage": {
"rootDirectory": "/tmp/zot",
"remoteCache": true,
"cacheDriver": {
"name": "redis",
"url": "redis://localhost:6379",
"keyprefix": "zot"
}
}The "name" setting selects the Redis driver implementation. The "keyprefix" is a string prepended to all Redis keys created by this zot instance. The "url" setting points to the Redis server (or servers in the case of a Redis cluster). More details on how this is parsed are available at:
- https://github.com/redis/go-redis/blob/v9.7.0/options.go#L247
- https://github.com/redis/go-redis/blob/v9.7.0/osscluster.go#L144
If the "url" setting is missing, the parameters need to be passed individually as keys in the same "cacheDriver" map. The keys are the same as the attributes that would otherwise be included in the "url". Note that at this time the library we import only supports "url" parsing in the case of a Redis single instance, or cluster configuration. In the case of a Redis Sentinel setup, you would need to add each key manually in the "cacheDriver" map and make sure to specify a "master_name" key, see https://github.com/redis/go-redis/blob/v9.7.0/universal.go#L240
Enable and configure sync with:
"sync": {
Configure credentials for upstream registries:
"credentialsFile": "./examples/sync-auth-filepath.json",
Configure each registry sync:
"registries": [{
"urls": ["https://registry1:5000"],
"onDemand": false, # pull any image which the local registry doesn't have
"onDemandInBackground": false, # return immediately when the manifest is missing locally and sync it into storage in the background; requires onDemand; incompatible with manifestCheckInterval
"stream": false, # serve an on-demand image to the client while it downloads instead of after it is synced; requires onDemand and https urls with tlsVerify; incompatible with onDemandInBackground and maxRetries/retryDelay. See "Streaming on-demand sync" below
"maxConcurrentStreams": 32, # with stream: cap on distinct blobs streaming at once, shared by all streaming registries (all must agree); past it, requests use blocking on-demand sync (default: 32)
"pollInterval": "6h", # polling interval, if not set then periodically polling will not run
"platforms": ["linux/amd64"], # periodic sync default: sparse-copy these OS/arch[/variant] children; omit/empty = all. Overridden by content[].platforms when set. On-demand ignores both. Extra slash tokens beyond three are ignored by platform.Parse (not rejected).
"manifestCheckInterval": "1h", # minimum interval between upstream manifest checks for the same repo:tag when serving on-demand requests; when 0 or unset every request checks upstream; when negative (e.g. -1) a locally present tag is never checked upstream. Requires onDemand.
"manifestCheckTimeout": "10s", # max time the registry call of an on-demand sync has to connect and answer the manifest request (dial, TLS and response, retries included); past it a locally present manifest is served. 0 or unset: bounded by syncTimeout only. Requires onDemand. See "Sync's manifestCheckTimeout option" below
"tlsVerify": true, # whether or not to verify tls (default is true)
"certDir": "/home/user/certs", # use certificates at certDir path similar to Docker's /etc/docker/certs.d., if not specified then use the default certs dir,
"maxRetries": 5, # maxRetries in case of temporary errors (default: no retries)
"retryDelay": "1s", # initial HTTP retry delay; mandatory when using maxRetries
"maxRetryDelay": "30s", # max HTTP retry backoff; optional, defaults to retryDelay (fixed interval). Set higher than retryDelay for exponential backoff.
"reqConcurrent": 30, # max concurrent in-flight requests per host, applied independently to this upstream and to each of its mirrors, not shared across them (default: 3); raise it when one zot proxies many concurrent on-demand pulls from a single upstream
"reqPerSec": 100, # max request rate (requests/second) per host, applied independently to this upstream and to each of its mirrors, not shared across them (default: unlimited)
"disableHTTP2": true, # force HTTP/1.1 to the upstream, so each concurrent request opens its own TCP connection instead of sharing the single connection (and congestion window) HTTP/2 multiplexes requests onto (default: false, i.e. HTTP/2 is negotiated when the upstream supports it)
"maxIdleConnsPerHost": 30, # per-host idle connection pool size (default: 2; when disableHTTP2 is true and this is unset, defaults to reqConcurrent instead, so pooled HTTP/1.1 connections aren't closed under concurrency)
"onlySigned": true, # when true, tag sync requires a remote signature (notary/cosign/referrers). On-demand digest pulls skip that check so multi-arch tag→digest client flows work (signatures normally cover the index, not each platform child). A client that already knows an upstream digest can therefore sync that manifest without a per-manifest signature. Periodic child digests after a signed tag also skip re-checking.
"exclude": ["private/**"], # local repos never synced from this registry, periodically or on demand; served from local storage only. Same glob syntax as content prefixes, matched against the local repo name. See "Sync's exclude option" below
"content":[ # which content to periodically pull, also it's used for filtering ondemand images, if not set then periodically polling will not run
{
"prefix":"/repo1/repo", # pull image repo1/repo
"tags":{ # filter by tags
"regex":"4.*", # filter tags by regex
"semver":true # filter tags by semver compliance
}
},
{
"prefix":"/repo2/repo*" # pull all images that matches repo2/repo.*
},
{
"prefix":"/repo3/**" # pull all images under repo3/ (matches recursively all repos under repo3/)
},
{
"prefix":"/repo4/**", # pull all images under repo4/
"platforms": ["linux/amd64"] # optional: overrides registries[].platforms for this prefix only (periodic); omit to inherit; [] means all platforms
},
{
"prefix":"/repo1/repo", # pull /repo1/repo
"destination":"/localrepo", # put /repo1/repo under /localrepo
"stripPrefix":true # strip the path specified in "prefix", if true resulting /localpath, if false resulting /localrepo/repo1/repo"
}
{
"prefix":"/repo1/**", # pull all images under repo1/ (matches recursively all repos under repo1/)
"destination":"/localrepo", # put all images found under /localrepo.
"stripPrefix":true # strip the path specified in "prefix" until meta-characters like "**". If we match /repo1/repo the local repo will be /localrepo/repo.
}
]
},
{
"urls": ["https://registry2:5000", "https://registry3:5000"], // specify multiple URLs in case first encounters an error
"pollInterval": "12h",
"tlsVerify": false,
"onDemand": false,
"content":[
{
"prefix":"/repo2",
"tags":{
"semver":true
}
}
]
},
{
"urls": ["https://index.docker.io"],
"onDemand": true, # doesn't have content, don't periodically pull, pull just on demand.
"tlsVerify": true,
"maxRetries": 3,
"retryDelay": "15m", # initial HTTP retry delay; fixed 15m interval unless maxRetryDelay is set higher
"maxRetryDelay": "15m" # optional; omit or set equal to retryDelay for fixed interval (as here)
}
]
}
Prefixes can be strings that exactly match repositories or they can be glob patterns.
content lists the repositories to sync. exclude does the opposite: it lists repositories that are
never synced from a registry, so they can be pushed to and pulled from zot like any repository that is
not synced, for instance when the same zot is both a pull-through cache and the registry for your own
images:
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"exclude": ["mycompany/**", "internal/app"]
}]
Requests for mycompany/... and internal/app are then served from local storage only, and a
reference that is not stored locally returns 404 without contacting upstream. Every other
repository is still synced on demand. Notes:
- entries are glob patterns, like content
prefixes;
mycompany/**matchesmycompanyand every repository under it - they are matched against the local repository name, after
destinationandstripPrefixare applied, and win overcontent: a repository that matches both is not synced - they apply to periodic and on-demand sync, including
streamandonDemandInBackground - they apply to the registry they are set on; with several registries, set them on each registry a repository must not be synced from
With onDemand enabled, every request for a tag validates the manifest against the upstream
registry, because a tag is mutable and may have been repushed. When pulls are frequent and
upstream rarely changes, manifestCheckInterval throttles that validation:
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"manifestCheckInterval": "10m"
}]
While the interval has not elapsed since the last successful upstream check, a locally present manifest is served without contacting upstream, which makes already synced images effectively local. Notes:
- the default is 0, which keeps checking upstream on every request
- it requires
onDemand, since it only affects on-demand requests, never periodic sync - requests by digest are unaffected, a locally present digest is already served without contacting upstream
- a local miss, for instance after garbage collection, always falls back to a normal sync
- the last check time is kept in memory, so the first request after a restart checks upstream again
Set a negative value, such as -1, to never check a locally present tag against upstream, for
instance for release tags that are never repushed, or when upstream is often unreachable:
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"manifestCheckInterval": -1
}]
A locally present tag is then served without contacting upstream, also when it was copied into
storage instead of synced, and also after a restart. A tag that is not present locally is still
synced on demand. A tag repushed upstream is not updated. With content rules, this applies only
to the repositories they match.
An on-demand request for a tag asks the upstream registry for the manifest, to check whether the
tag moved, before the locally stored manifest is served. When the upstream can't be reached, for
instance because packets to it are dropped, that request only fails after the TCP dial timeout,
and clients such as Docker often give up before zot falls back to the stored manifest.
manifestCheckTimeout bounds how long the upstream has to answer:
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"manifestCheckTimeout": "10s"
}]
Past the timeout the upstream request is abandoned and the request is handled like any other failed upstream check: a locally present manifest is served, and a manifest that isn't stored locally gets an error instead of a response that never comes. Notes:
- the default is 0, which leaves the request bounded by
syncTimeoutonly - it requires
onDemand, since it only affects on-demand requests, never periodic sync - it limits the call to the registry: connecting, the TLS handshake and the manifest response,
with retries (
maxRetries) included; it does not cover the request to a separate token server for authentication, nor downloading the image once the manifest has been received - it applies to each upstream request on its own: with several registries matching a repository,
each one that is tried gets the full timeout, and with
stream, a request whose streaming lookup times out gets it once more for the regular on-demand sync it falls back to - pick a value well above the time the upstream normally takes to answer, or images that are not stored locally fail to sync
- a check that timed out is not recorded as a successful one, so the next request checks
upstream again; combine it with
manifestCheckIntervalto skip the upstream check for tags that were checked recently
Set "onDemand": true and "onDemandInBackground": true so that when a requested manifest is not
present locally, zot returns immediately and syncs the image into storage in the background (only from
registries that enable onDemandInBackground for that repo). Later requests can be served from local
storage once sync completes.
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"onDemandInBackground": true
}]
Useful when a client can fall back to another registry for the same pull. Clients that talk only to
zot will receive a real 404 until the background sync finishes. Do not enable
onDemandInBackground for registries that are the client's only source.
Blob requests that miss locally still return 404; the background sync is started from the
manifest request and populates the full image in storage.
Notes:
- requires
onDemand - incompatible with
manifestCheckInterval(this mode does not revalidate tags on hit) - when multiple sync registries are configured, background sync applies per repo: only registries with
onDemandInBackgroundwhose content rules match the local repo are used for the background sync; other registries keep normal blocking on-demand for their repos
With "stream": true, a client pulling an image that is not yet local gets the upstream manifest
right away and its blobs as they arrive from upstream, instead of waiting for the whole image to be
synced. The sync into storage runs in the background. See examples/config-sync-streaming.json:
"registries": [{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"stream": true,
"maxConcurrentStreams": 32
}]
Notes:
- requires
onDemandandhttps://URLs withtlsVerify(the default): bytes reach the client before the blob's digest is verified, so the upstream must be authenticated - incompatible with
onDemandInBackground,maxRetries/retryDelayand"tlsVerify": false maxConcurrentStreams(default 32, must be > 0) is a single cap shared by every streaming registry, so all of them must set the same value; past it, requests fall back to blocking on-demand syncpreserveDigestis not needed: it is deprecated and ignored, and a streamed manifest is never converted- each blob being streamed is staged on local disk once, as for plain on-demand sync: its stream temp file
is hard-linked into the sync session. It lives under the storage root dir or, for S3/Azure/GCS, under
extensions.sync.downloadDir, which must then be set - a streamed blob is sent within one response, so
http.writeTimeout(default60s, an absolute deadline for writing the whole response) must cover the slowest blob pull expected, or the client is cut off mid-blob; the example sets30m. It applies to every response, so a higher value also lets a slow or stalled client hold its connection longer - design and on-disk layout:
pkg/extensions/sync/README_streaming_sync.md
sync uses the same logic for reading cert directory as docker: https://docs.docker.com/engine/security/certificates/#understand-the-configuration sync can also read the certificates directly under certDir:
- ca.crt - public pem cert of registry. Root CA that signed the registry certificate, in PEM.
- client.cert - public pem cert for client (mTLS)
- client.key - public key cert for client (mTLS)
Besides sync-auth.json file, zot also reads and uses docker credentials by default: https://docs.docker.com/reference/cli/docker/login/#description
The search extension can include a cve section so zot downloads the Trivy vulnerability database and exposes CVE data via the search API (for example GraphQL).
A minimal configuration only sets how often the DB is refreshed; zot applies defaults for Trivy DB locations and severity selection:
- config-cve.json —
updateIntervalonly; defaults are applied for the Trivy DB, Java DB (for language packages), andvulnSeveritySources.
To set those options explicitly (for example to mirror standalone Trivy’s --vuln-severity-source behavior), use a trivy object under cve:
- config-cve-trivy.json — shows optional
dbRepository,javaDBRepository,vulnSeveritySources,detectionPriority,scanRemovedPkgs, andincludeDevDeps. - config-sbom-trivy.json — adds
sbomto generate SBOMs during scanning.
ignoreFile specifies the path to a Trivy ignore file and supports the same plain-text and YAML formats as Trivy's --ignorefile option. The file must exist and be readable when zot loads its configuration. Relative paths are resolved from zot's process working directory, not from the directory containing the zot configuration file, so use an absolute path in deployments, for example "ignoreFile": "/etc/zot/.trivyignore". A sample .trivyignore is included in this directory.
Scan results are cached by manifest digest. Editing an ignore file does not invalidate existing cached results: newly ignored vulnerabilities can remain visible, and newly unignored vulnerabilities can remain hidden, until the CVE database refresh purges the scan cache or zot restarts. The minimum database updateInterval is two hours.
vulnSeveritySources is a list of source names in priority order (for example auto, nvd, or vendor IDs such as redhat, alpine). If omitted, zot defaults it to ["auto"], consistent with the Trivy CLI. See Trivy: severity selection.
detectionPriority mirrors Trivy's --detection-priority and accepts precise (default) or comprehensive. comprehensive stops Trivy filtering files owned by the OS package manager, so those files are reported a second time as language packages matched against NVD. On distributions that backport security fixes (RHEL, SLES) this typically results in reported vulnerabilities that the vendor has already patched.
scanRemovedPkgs mirrors Trivy's --removed-pkgs and reports vulnerabilities for packages deleted in later image layers. includeDevDeps mirrors Trivy's --include-dev-deps and reports development dependencies. Both default to false.
sbom.enable lets zot generate SBOMs while scanning and store them as OCI artifacts attached to the scanned image. sbom.format supports spdx-json (default) and cyclonedx.
The lint extension rejects image manifests that are missing any of the mandatoryAnnotations. An annotation is also accepted when it is set as a label in the image config. See config-lint.json.
Images that the sync extension copies from an upstream registry are linted too, so third-party images that lack the annotations cannot be mirrored. Set skipSyncedImages to true to lint only the images that clients push:
"extensions": {
"lint": {
"enable": true,
"mandatoryAnnotations": ["org.opencontainers.image.title", "org.opencontainers.image.description"],
"skipSyncedImages": true
},
"sync": {
"enable": true,
"registries": [
{
"urls": ["https://registry-1.docker.io"],
"onDemand": true,
"content": [{ "prefix": "**" }]
}
]
}
}skipSyncedImages defaults to false.