.nh .TH CONTAINERS\-REGISTRIES.CONF(5) System\-wide registry configuration file Brent Baude Aug 2017 .SH NAME .PP containers\-registries.conf \- Syntax of System Registry Configuration File .SH DESCRIPTION .PP The CONTAINERS\-REGISTRIES configuration file is a system\-wide configuration file for container image registries. The file format is TOML. .PP Container engines will use the \fB\fC$HOME/.config/containers/registries.conf\fR if it exists, otherwise they will use \fB\fC/etc/containers/registries.conf\fR .SS GLOBAL SETTINGS .TP \fB\fCunqualified\-search\-registries\fR An array of \fIhost\fP[\fB\fC:\fR\fIport\fP] registries to try when pulling an unqualified image, in order. .SS NAMESPACED \fB\fC[[registry]]\fR SETTINGS .PP The bulk of the configuration is represented as an array of \fB\fC[[registry]]\fR TOML tables; the settings may therefore differ among different registries as well as among different namespaces/repositories within a registry. .SS Choosing a \fB\fC[[registry]]\fR TOML table .PP Given an image name, a single \fB\fC[[registry]]\fR TOML table is chosen based on its \fB\fCprefix\fR field. .TP \fB\fCprefix\fR A prefix of the user\-specified image name, i.e. using one of the following formats: .RS .IP \(bu 2 \fIhost\fP[\fB\fC:\fR\fIport\fP] .IP \(bu 2 \fIhost\fP[\fB\fC:\fR\fIport\fP]\fB\fC/\fR\fInamespace\fP[\fB\fC/\fR\_namespace\_…] .IP \(bu 2 \fIhost\fP[\fB\fC:\fR\fIport\fP]\fB\fC/\fR\fInamespace\fP[\fB\fC/\fR\_namespace\_…]\fB\fC/\fR\fIrepo\fP .IP \(bu 2 \fIhost\fP[\fB\fC:\fR\fIport\fP]\fB\fC/\fR\fInamespace\fP[\fB\fC/\fR\_namespace\_…]\fB\fC/\fR\fIrepo\fP(\fB\fC:\fR\_tag|\fB\fC@\fR\fIdigest\fP) .RE The user\-specified image name must start with the specified \fB\fCprefix\fR (and continue with the appropriate separator) for a particular \fB\fC[[registry]]\fR TOML table to be considered; (only) the TOML table with the longest match is used.As a special case, the \fB\fCprefix\fR field can be missing; if so, it defaults to the value of the \fB\fClocation\fR field (described below). .SS Per\-namespace settings .TP \fB\fCinsecure\fR \fB\fCtrue\fR or \fB\fCfalse\fR\&. By default, container runtimes require TLS when retrieving images from a registry. If \fB\fCinsecure\fR is set to \fB\fCtrue\fR, unencrypted HTTP as well as TLS connections with untrusted certificates are allowed. .TP \fB\fCblocked\fR \fB\fCtrue\fR or \fB\fCfalse\fR\&. If \fB\fCtrue\fR, pulling images with matching names is forbidden. .SS Remapping and mirroring registries .PP The user\-specified image reference is, primarily, a "logical" image name, always used for naming the image. By default, the image reference also directly specifies the registry and repository to use, but the following options can be used to redirect the underlying accesses to different registry servers or locations (e.g. to support configurations with no access to the internet without having to change \fB\fCDockerfile\fRs, or to add redundancy). .TP \fB\fClocation\fR Accepts the same format as the \fB\fCprefix\fR field, and specifies the physical location of the \fB\fCprefix\fR\-rooted namespace.By default, this equal to \fB\fCprefix\fR (in which case \fB\fCprefix\fR can be omitted and the \fB\fC[[registry]]\fR TOML table can only specify \fB\fClocation\fR).Example: Given .PP .RS .nf prefix = "example.com/foo" location = "internal\-registry\-for\-example.net/bar" .fi .RE requests for the image \fB\fCexample.com/foo/myimage:latest\fR will actually work with the \fB\fCinternal\-registry\-for\-example.net/bar/myimage:latest\fR image. .TP \fB\fCmirror\fR An array of TOML tables specifying (possibly\-partial) mirrors for the \fB\fCprefix\fR\-rooted namespace.The mirrors are attempted in the specified order; the first one that can be contacted and contains the image will be used (and if none of the mirrors contains the image, the primary location specified by the \fB\fCregistry.location\fR field, or using the unmodified user\-specified reference, is tried last).Each TOML table in the \fB\fCmirror\fR array can contain the following fields, with the same semantics as if specified in the \fB\fC[[registry]]\fR TOML table directly: .RS .IP \(bu 2 \fB\fClocation\fR .IP \(bu 2 \fB\fCinsecure\fR .RE .TP \fB\fCmirror\-by\-digest\-only\fR \fB\fCtrue\fR or \fB\fCfalse\fR\&. If \fB\fCtrue\fR, mirrors will only be used during pulling if the image reference includes a digest. Referencing an image by digest ensures that the same is always used (whereas referencing an image by a tag may cause different registries to return different images if the tag mapping is out of sync).Note that if this is \fB\fCtrue\fR, images referenced by a tag will only use the primary registry, failing if that registry is not accessible. .PP \fINote\fP: Redirection and mirrors are currently processed only when reading images, not when pushing to a registry; that may change in the future. .SS Short\-Name Aliasing .PP The use of unqualified\-search registries entails an ambiguity as it is unclear from which registry a given image, referenced by a short name, may be pulled from. .PP As mentioned in the note at the end of this man page, using short names is subject to the risk of hitting squatted registry namespaces. If the unqualified\-search registries are set to \fB\fC["registry1.com", "registry2.com"]\fR an attacker may take over a namespace of registry1.com such that an image may be pulled from registry1.com instead of the intended source registry2.com. .PP While it is highly recommended to always use fully\-qualified image references, existing deployments using short names may not be easily changed. To circumvent the aforementioned ambiguity, so called short\-name aliases can be configured that point to a fully\-qualified image reference. .PP Short\-name aliases can be configured in the \fB\fC[aliases]\fR table in the form of \fB\fC"name"="value"\fR with the left\-hand \fB\fCname\fR being the short name (e.g., "image") and the right\-hand \fB\fCvalue\fR being the fully\-qualified image reference (e.g., "registry.com/namespace/image"). Note that neither "name" nor "value" can include a tag or digest. Moreover, "name" must be a short name and hence cannot include a registry domain or refer to localhost. .PP When pulling a short name, the configured aliases table will be used for resolving the short name. If a matching alias is found, it will be used without further consulting the unqualified\-search registries list. If no matching alias is found, the behavior can be controlled via the \fB\fCshort\-name\-mode\fR option as described below. .PP Note that tags and digests are stripped off a user\-specified short name for alias resolution. Hence, "image", "image:tag" and "image@digest" all resolve to the same alias (i.e., "image"). Stripped off tags and digests are later appended to the resolved alias. .PP Further note that drop\-in configuration files (see containers\-registries.conf.d(5)) can override aliases in the specific loading order of the files. If the "value" of an alias is empty (i.e., ""), the alias will be erased. However, a given "name" may only be specified once in a single config file. .SS Short\-Name Aliasing: Modes .PP The \fB\fCshort\-name\-mode\fR option supports three modes to control the behaviour of short\-name resolution. .RS .IP \(bu 2 \fB\fCenforcing\fR: If only one unqualified\-search registry is set, use it as there is no ambiguity. If there is more than one registry and the user program is running in a terminal (i.e., stdout \& stdin are a TTY), prompt the user to select one of the specified search registries. If the program is not running in a terminal, the ambiguity cannot be resolved which will lead to an error. .IP \(bu 2 \fB\fCpermissive\fR: Behaves as enforcing but does not lead to an error if the program is not running in a terminal. Instead, fallback to using all unqualified\-search registries. .IP \(bu 2 \fB\fCdisabled\fR: Use all unqualified\-search registries without prompting. .RE .PP If \fB\fCshort\-name\-mode\fR is not specified at all or left empty, default to the \fB\fCpermissive\fR mode. If the user\-specified short name was not aliased already, the \fB\fCenforcing\fR and \fB\fCpermissive\fR mode if prompted, will record a new alias after a successful pull. Note that the recorded alias will be written to \fB\fC/var/cache/containers/short\-name\-aliases.conf\fR for root to have a clear separation between possibly human\-edited registries.conf files and the machine\-generated \fB\fCshort\-name\-aliases\-conf\fR\&. Note that \fB\fC$HOME/.cache\fR is used for rootless users. If an alias is specified in a \fB\fCregistries.conf\fR file and also the machine\-generated \fB\fCshort\-name\-aliases.conf\fR, the \fB\fCshort\-name\-aliases.conf\fR file has precedence. .SS Normalization of docker.io references .PP The Docker Hub \fB\fCdocker.io\fR is handled in a special way: every push and pull operation gets internally normalized with \fB\fC/library\fR if no other specific namespace is defined (for example on \fB\fCdocker.io/namespace/image\fR). .PP (Note that the above\-described normalization happens to match the behavior of Docker.) .PP This means that a pull of \fB\fCdocker.io/alpine\fR will be internally translated to \fB\fCdocker.io/library/alpine\fR\&. A pull of \fB\fCdocker.io/user/alpine\fR will not be rewritten because this is already the correct remote path. .PP Therefore, to remap or mirror the \fB\fCdocker.io\fR images in the (implied) \fB\fC/library\fR namespace (or that whole namespace), the prefix and location fields in this configuration file must explicitly include that \fB\fC/library\fR namespace. For example \fB\fCprefix = "docker.io/library/alpine"\fR and not \fB\fCprefix = "docker.io/alpine"\fR\&. The latter would match the \fB\fCdocker.io/alpine/*\fR repositories but not the \fB\fCdocker.io/[library/]alpine\fR image). .SS EXAMPLE .PP .RS .nf unqualified\-search\-registries = ["example.com"] [[registry]] prefix = "example.com/foo" insecure = false blocked = false location = "internal\-registry\-for\-example.com/bar" [[registry.mirror]] location = "example\-mirror\-0.local/mirror\-for\-foo" [[registry.mirror]] location = "example\-mirror\-1.local/mirrors/foo" insecure = true .fi .RE .PP Given the above, a pull of \fB\fCexample.com/foo/image:latest\fR will try: 1. \fB\fCexample\-mirror\-0.local/mirror\-for\-foo/image:latest\fR 2. \fB\fCexample\-mirror\-1.local/mirrors/foo/image:latest\fR 3. \fB\fCinternal\-registry\-for\-example.net/bar/image:latest\fR .PP in order, and use the first one that exists. .SH VERSION 1 FORMAT \- DEPRECATED .PP VERSION 1 format is still supported but it does not support using registry mirrors, longest\-prefix matches, or location rewriting. .PP The TOML format is used to build a simple list of registries under three categories: \fB\fCregistries.search\fR, \fB\fCregistries.insecure\fR, and \fB\fCregistries.block\fR\&. You can list multiple registries using a comma separated list. .PP Search registries are used when the caller of a container runtime does not fully specify the container image that they want to execute. These registries are prepended onto the front of the specified container image until the named image is found at a registry. .PP Note that insecure registries can be used for any registry, not just the registries listed under search. .PP The \fB\fCregistries.insecure\fR and \fB\fCregistries.block\fR lists have the same meaning as the \fB\fCinsecure\fR and \fB\fCblocked\fR fields in the current version. .SS EXAMPLE .PP The following example configuration defines two searchable registries, one insecure registry, and two blocked registries. .PP .RS .nf [registries.search] registries = ['registry1.com', 'registry2.com'] [registries.insecure] registries = ['registry3.com'] [registries.block] registries = ['registry.untrusted.com', 'registry.unsafe.com'] .fi .RE .SH NOTE: RISK OF USING UNQUALIFIED IMAGE NAMES .PP We recommend always using fully qualified image names including the registry server (full dns name), namespace, image name, and tag (e.g., registry.redhat.io/ubi8/ubi:latest). When using short names, there is always an inherent risk that the image being pulled could be spoofed. For example, a user wants to pull an image named \fB\fCfoobar\fR from a registry and expects it to come from myregistry.com. If myregistry.com is not first in the search list, an attacker could place a different \fB\fCfoobar\fR image at a registry earlier in the search list. The user would accidentally pull and run the attacker's image and code rather than the intended content. We recommend only adding registries which are completely trusted, i.e. registries which don't allow unknown or anonymous users to create accounts with arbitrary names. This will prevent an image from being spoofed, squatted or otherwise made insecure. If it is necessary to use one of these registries, it should be added at the end of the list. .PP It is recommended to use fully\-qualified images for pulling as the destination registry is unambiguous. Pulling by digest (i.e., quay.io/repository/name@digest) further eliminates the ambiguity of tags. .SH SEE ALSO .PP containers\-certs.d(5) .SH HISTORY .PP Dec 2019, Warning added for unqualified image names by Tom Sweeney tsweeney@redhat.com \[la]mailto:tsweeney@redhat.com\[ra] .PP Mar 2019, Added additional configuration format by Sascha Grunert sgrunert@suse.com \[la]mailto:sgrunert@suse.com\[ra] .PP Aug 2018, Renamed to containers\-registries.conf(5) by Valentin Rothberg vrothberg@suse.com \[la]mailto:vrothberg@suse.com\[ra] .PP Jun 2018, Updated by Tom Sweeney tsweeney@redhat.com \[la]mailto:tsweeney@redhat.com\[ra] .PP Aug 2017, Originally compiled by Brent Baude bbaude@redhat.com \[la]mailto:bbaude@redhat.com\[ra]