aaf3a50
% CONTAINERS-REGISTRIES.CONF(5) System-wide registry configuration file
aaf3a50
% Brent Baude
aaf3a50
% Aug 2017
b646a7f
aaf3a50
# NAME
aaf3a50
containers-registries.conf - Syntax of System Registry Configuration File
b646a7f
aaf3a50
# DESCRIPTION
aaf3a50
The CONTAINERS-REGISTRIES configuration file is a system-wide configuration
45fa0f8
file for container image registries. The file format is TOML.
b646a7f
3d4e4fd
Container engines will use the `$HOME/.config/containers/registries.conf` if it exists, otherwise they will use `/etc/containers/registries.conf`
b646a7f
22ca95d
### GLOBAL SETTINGS
22ca95d
22ca95d
`unqualified-search-registries`
22ca95d
: An array of _host_[`:`_port_] registries to try when pulling an unqualified image, in order.
22ca95d
22ca95d
### NAMESPACED `[[registry]]` SETTINGS
22ca95d
22ca95d
The bulk of the configuration is represented as an array of `[[registry]]`
22ca95d
TOML tables; the settings may therefore differ among different registries
22ca95d
as well as among different namespaces/repositories within a registry.
22ca95d
22ca95d
#### Choosing a `[[registry]]` TOML table
22ca95d
22ca95d
Given an image name, a single `[[registry]]` TOML table is chosen based on its `prefix` field.
22ca95d
22ca95d
`prefix`
22ca95d
: A prefix of the user-specified image name, i.e. using one of the following formats:
22ca95d
    - _host_[`:`_port_]
22ca95d
    - _host_[`:`_port_]`/`_namespace_[`/`_namespace_…]
22ca95d
    - _host_[`:`_port_]`/`_namespace_[`/`_namespace_…]`/`_repo_
22ca95d
    - _host_[`:`_port_]`/`_namespace_[`/`_namespace_…]`/`_repo_(`:`_tag|`@`_digest_)
22ca95d
22ca95d
    The user-specified image name must start with the specified `prefix` (and continue
22ca95d
    with the appropriate separator) for a particular `[[registry]]` TOML table to be
22ca95d
    considered; (only) the TOML table with the longest match is used.
22ca95d
22ca95d
    As a special case, the `prefix` field can be missing; if so, it defaults to the value
22ca95d
    of the `location` field (described below).
22ca95d
22ca95d
#### Per-namespace settings
22ca95d
22ca95d
`insecure`
22ca95d
: `true` or `false`.
22ca95d
    By default, container runtimes require TLS when retrieving images from a registry.
22ca95d
    If `insecure` is set to `true`, unencrypted HTTP as well as TLS connections with untrusted
22ca95d
    certificates are allowed.
22ca95d
22ca95d
`blocked`
22ca95d
: `true` or `false`.
22ca95d
    If `true`, pulling images with matching names is forbidden.
22ca95d
22ca95d
#### Remapping and mirroring registries
22ca95d
22ca95d
The user-specified image reference is, primarily, a "logical" image name, always used for naming
22ca95d
the image.  By default, the image reference also directly specifies the registry and repository
22ca95d
to use, but the following options can be used to redirect the underlying accesses
22ca95d
to different registry servers or locations (e.g. to support configurations with no access to the
22ca95d
internet without having to change `Dockerfile`s, or to add redundancy).
22ca95d
22ca95d
`location`
22ca95d
: Accepts the same format as the `prefix` field, and specifies the physical location
22ca95d
    of the `prefix`-rooted namespace.
22ca95d
22ca95d
    By default, this equal to `prefix` (in which case `prefix` can be omitted and the
22ca95d
    `[[registry]]` TOML table can only specify `location`).
22ca95d
22ca95d
    Example: Given
22ca95d
    ```
22ca95d
    prefix = "example.com/foo"
22ca95d
    location = "internal-registry-for-example.net/bar"
22ca95d
    ```
22ca95d
    requests for the image `example.com/foo/myimage:latest` will actually work with the
22ca95d
    `internal-registry-for-example.net/bar/myimage:latest` image.
22ca95d
22ca95d
`mirror`
22ca95d
: An array of TOML tables specifying (possibly-partial) mirrors for the
22ca95d
    `prefix`-rooted namespace.
22ca95d
22ca95d
    The mirrors are attempted in the specified order; the first one that can be
22ca95d
    contacted and contains the image will be used (and if none of the mirrors contains the image,
22ca95d
    the primary location specified by the `registry.location` field, or using the unmodified
22ca95d
    user-specified reference, is tried last).
22ca95d
22ca95d
    Each TOML table in the `mirror` array can contain the following fields, with the same semantics
22ca95d
    as if specified in the `[[registry]]` TOML table directly:
22ca95d
    - `location`
22ca95d
    - `insecure`
22ca95d
22ca95d
`mirror-by-digest-only`
22ca95d
: `true` or `false`.
22ca95d
    If `true`, mirrors will only be used during pulling if the image reference includes a digest.
22ca95d
    Referencing an image by digest ensures that the same is always used
22ca95d
    (whereas referencing an image by a tag may cause different registries to return
22ca95d
    different images if the tag mapping is out of sync).
22ca95d
22ca95d
    Note that if this is `true`, images referenced by a tag will only use the primary
22ca95d
    registry, failing if that registry is not accessible.
22ca95d
22ca95d
*Note*: Redirection and mirrors are currently processed only when reading images, not when pushing
22ca95d
to a registry; that may change in the future.
45fa0f8
932609e
#### Normalization of docker.io references
932609e
932609e
The Docker Hub `docker.io` is handled in a special way: every push and pull
932609e
operation gets internally normalized with `/library` if no other specific
932609e
namespace is defined (for example on `docker.io/namespace/image`).
932609e
932609e
(Note that the above-described normalization happens to match the behavior of
932609e
Docker.)
932609e
932609e
This means that a pull of `docker.io/alpine` will be internally translated to
932609e
`docker.io/library/alpine`. A pull of `docker.io/user/alpine` will not be
932609e
rewritten because this is already the correct remote path.
932609e
932609e
Therefore, to remap or mirror the `docker.io` images in the (implied) `/library`
932609e
namespace (or that whole namespace), the prefix and location fields in this
932609e
configuration file must explicitly include that `/library` namespace. For
932609e
example `prefix = "docker.io/library/alpine"` and not `prefix =
932609e
"docker.io/alpine"`. The latter would match the `docker.io/alpine/*`
932609e
repositories but not the `docker.io/[library/]alpine` image).
932609e
45fa0f8
### EXAMPLE
45fa0f8
45fa0f8
```
22ca95d
unqualified-search-registries = ["example.com"]
22ca95d
45fa0f8
[[registry]]
45fa0f8
prefix = "example.com/foo"
22ca95d
insecure = false
45fa0f8
blocked = false
22ca95d
location = "internal-registry-for-example.com/bar"
22ca95d
22ca95d
[[registry.mirror]]
22ca95d
location = "example-mirror-0.local/mirror-for-foo"
22ca95d
22ca95d
[[registry.mirror]]
22ca95d
location = "example-mirror-1.local/mirrors/foo"
22ca95d
insecure = true
45fa0f8
```
22ca95d
Given the above, a pull of `example.com/foo/image:latest` will try:
22ca95d
    1. `example-mirror-0.local/mirror-for-foo/image:latest`
22ca95d
    2. `example-mirror-1.local/mirrors/foo/image:latest`
3d4e4fd
    3. `internal-registry-for-example.net/bar/image:latest`
22ca95d
22ca95d
in order, and use the first one that exists.
45fa0f8
e6a15e0
## VERSION 1 FORMAT - DEPRECATED
e6a15e0
VERSION 1 format is still supported but it does not support
e6a15e0
using registry mirrors, longest-prefix matches, or location rewriting.
e6a15e0
e6a15e0
The TOML format is used to build a simple list of registries under three
e6a15e0
categories: `registries.search`, `registries.insecure`, and `registries.block`.
e6a15e0
You can list multiple registries using a comma separated list.
e6a15e0
e6a15e0
Search registries are used when the caller of a container runtime does not fully specify the
e6a15e0
container image that they want to execute.  These registries are prepended onto the front
e6a15e0
of the specified container image until the named image is found at a registry.
e6a15e0
e6a15e0
Note that insecure registries can be used for any registry, not just the registries listed
e6a15e0
under search.
e6a15e0
e6a15e0
The `registries.insecure` and `registries.block` lists have the same meaning as the
e6a15e0
`insecure` and `blocked` fields in the current version.
e6a15e0
e6a15e0
### EXAMPLE
e6a15e0
The following example configuration defines two searchable registries, one
e6a15e0
insecure registry, and two blocked registries.
e6a15e0
e6a15e0
```
e6a15e0
[registries.search]
e6a15e0
registries = ['registry1.com', 'registry2.com']
e6a15e0
e6a15e0
[registries.insecure]
e6a15e0
registries = ['registry3.com']
e6a15e0
e6a15e0
[registries.block]
e6a15e0
registries = ['registry.untrusted.com', 'registry.unsafe.com']
e6a15e0
```
e6a15e0
3d4e4fd
# NOTE: RISK OF USING UNQUALIFIED IMAGE NAMES
3d4e4fd
We recommend always using fully qualified image names including the registry
3d4e4fd
server (full dns name), namespace, image name, and tag
3d4e4fd
(e.g., registry.redhat.io/ubi8/ubi:latest). When using short names, there is
3d4e4fd
always an inherent risk that the image being pulled could be spoofed. For
3d4e4fd
example, a user wants to pull an image named `foobar` from a registry and
3d4e4fd
expects it to come from myregistry.com. If myregistry.com is not first in the
3d4e4fd
search list, an attacker could place a different `foobar` image at a registry
3d4e4fd
earlier in the search list. The user would accidentally pull and run the
3d4e4fd
attacker's image and code rather than the intended content. We recommend only
3d4e4fd
adding registries which are completely trusted, i.e. registries which don't
3d4e4fd
allow unknown or anonymous users to create accounts with arbitrary names. This
3d4e4fd
will prevent an image from being spoofed, squatted or otherwise made insecure.
3d4e4fd
If it is necessary to use one of these registries, it should be added at the
3d4e4fd
end of the list.
932609e
932609e
It is recommended to use fully-qualified images for pulling as
932609e
the destination registry is unambiguous. Pulling by digest
932609e
(i.e., quay.io/repository/name@digest) further eliminates the ambiguity of
932609e
tags.
932609e
3d4e4fd
# SEE ALSO
3d4e4fd
  containers-certs.d(5)
3d4e4fd
aaf3a50
# HISTORY
932609e
Dec 2019, Warning added for unqualified image names by Tom Sweeney <tsweeney@redhat.com>
932609e
45fa0f8
Mar 2019, Added additional configuration format by Sascha Grunert <sgrunert@suse.com>
45fa0f8
aaf3a50
Aug 2018, Renamed to containers-registries.conf(5) by Valentin Rothberg <vrothberg@suse.com>
aaf3a50
aaf3a50
Jun 2018, Updated by Tom Sweeney <tsweeney@redhat.com>
aaf3a50
aaf3a50
Aug 2017, Originally compiled by Brent Baude <bbaude@redhat.com>