de7ddf
% CONTAINERS-REGISTRIES.D(5) Registries.d Man Page
de7ddf
% Miloslav Trmač
de7ddf
% August 2016
de7ddf
de7ddf
# NAME
de7ddf
containers-registries.d - Directory for various registries configurations
de7ddf
de7ddf
# DESCRIPTION
de7ddf
de7ddf
The registries configuration directory contains configuration for various registries
de7ddf
(servers storing remote container images), and for content stored in them,
de7ddf
so that the configuration does not have to be provided in command-line options over and over for every command,
de7ddf
and so that it can be shared by all users of containers/image.
de7ddf
de7ddf
By default, the registries configuration directory is `$HOME/.config/containers/registries.d` if it exists, otherwise `/etc/containers/registries.d` (unless overridden at compile-time);
de7ddf
applications may allow using a different directory instead.
de7ddf
de7ddf
## Directory Structure
de7ddf
de7ddf
The directory may contain any number of files with the extension `.yaml`,
de7ddf
each using the YAML format.  Other than the mandatory extension, names of the files
de7ddf
don’t matter.
de7ddf
de7ddf
The contents of these files are merged together; to have a well-defined and easy to understand
de7ddf
behavior, there can be only one configuration section describing a single namespace within a registry
de7ddf
(in particular there can be at most one one `default-docker` section across all files,
de7ddf
and there can be at most one instance of any key under the `docker` section;
de7ddf
these sections are documented later).
de7ddf
de7ddf
Thus, it is forbidden to have two conflicting configurations for a single registry or scope,
de7ddf
and it is also forbidden to split a configuration for a single registry or scope across
de7ddf
more than one file (even if they are not semantically in conflict).
de7ddf
de7ddf
## Registries, Scopes and Search Order
de7ddf
de7ddf
Each YAML file must contain a “YAML mapping” (key-value pairs).  Two top-level keys are defined:
de7ddf
de7ddf
- `default-docker` is the _configuration section_ (as documented below)
de7ddf
   for registries implementing "Docker Registry HTTP API V2".
de7ddf
de7ddf
   This key is optional.
de7ddf
de7ddf
- `docker` is a mapping, using individual registries implementing "Docker Registry HTTP API V2",
de7ddf
   or namespaces and individual images within these registries, as keys;
de7ddf
   the value assigned to any such key is a _configuration section_.
de7ddf
de7ddf
   This key is optional.
de7ddf
de7ddf
   Scopes matching individual images are named Docker references *in the fully expanded form*, either
de7ddf
   using a tag or digest. For example, `docker.io/library/busybox:latest` (*not* `busybox:latest`).
de7ddf
de7ddf
   More general scopes are prefixes of individual-image scopes, and specify a repository (by omitting the tag or digest),
de7ddf
   a repository namespace, or a registry host (and a port if it differs from the default).
de7ddf
de7ddf
   Note that if a registry is accessed using a hostname+port configuration, the port-less hostname
de7ddf
   is _not_ used as parent scope.
de7ddf
de7ddf
When searching for a configuration to apply for an individual container image, only
de7ddf
the configuration for the most-precisely matching scope is used; configuration using
de7ddf
more general scopes is ignored.  For example, if _any_ configuration exists for
de7ddf
`docker.io/library/busybox`, the configuration for `docker.io` is ignored
de7ddf
(even if some element of the configuration is defined for `docker.io` and not for `docker.io/library/busybox`).
de7ddf
de7ddf
### Built-in Defaults
de7ddf
de7ddf
If no `docker` section can be found for the container image, and no `default-docker` section is configured,
de7ddf
the default directory, `/var/lib/containers/sigstore` for root and `$HOME/.local/share/containers/sigstore` for unprivileged user,  will be used for reading and writing signatures.
de7ddf
de7ddf
## Individual Configuration Sections
de7ddf
de7ddf
A single configuration section is selected for a container image using the process
de7ddf
described above.  The configuration section is a YAML mapping, with the following keys:
de7ddf
de7ddf
- `sigstore-staging` defines an URL of of the signature storage, used for editing it (adding or deleting signatures).
de7ddf
de7ddf
   This key is optional; if it is missing, `sigstore` below is used.
de7ddf
de7ddf
- `sigstore` defines an URL of the signature storage.
de7ddf
   This URL is used for reading existing signatures,
de7ddf
   and if `sigstore-staging` does not exist, also for adding or removing them.
de7ddf
de7ddf
   This key is optional; if it is missing, no signature storage is defined (no signatures
de7ddf
   are download along with images, adding new signatures is possible only if `sigstore-staging` is defined).
de7ddf
de7ddf
de7ddf
## Examples
de7ddf
de7ddf
### Using Containers from Various Origins
de7ddf
de7ddf
The following demonstrates how to to consume and run images from various registries and namespaces:
de7ddf
de7ddf
```yaml
de7ddf
docker:
de7ddf
    registry.database-supplier.com:
de7ddf
        sigstore: https://sigstore.database-supplier.com
de7ddf
    distribution.great-middleware.org:
de7ddf
        sigstore: https://security-team.great-middleware.org/sigstore
de7ddf
    docker.io/web-framework:
de7ddf
        sigstore: https://sigstore.web-framework.io:8080
de7ddf
```
de7ddf
de7ddf
### Developing and Signing Containers, Staging Signatures
de7ddf
de7ddf
For developers in `example.com`:
de7ddf
de7ddf
- Consume most container images using the public servers also used by clients.
de7ddf
- Use a separate signature storage for an container images in a namespace corresponding to the developers' department, with a staging storage used before publishing signatures.
de7ddf
- Craft an individual exception for a single branch a specific developer is working on locally.
de7ddf
de7ddf
```yaml
de7ddf
docker:
de7ddf
    registry.example.com:
de7ddf
        sigstore: https://registry-sigstore.example.com
de7ddf
    registry.example.com/mydepartment:
de7ddf
        sigstore: https://sigstore.mydepartment.example.com
de7ddf
        sigstore-staging: file:///mnt/mydepartment/sigstore-staging
de7ddf
    registry.example.com/mydepartment/myproject:mybranch:
de7ddf
        sigstore: http://localhost:4242/sigstore
de7ddf
        sigstore-staging: file:///home/useraccount/webroot/sigstore
de7ddf
```
de7ddf
de7ddf
### A Global Default
de7ddf
de7ddf
If a company publishes its products using a different domain, and different registry hostname for each of them, it is still possible to use a single signature storage server
de7ddf
without listing each domain individually. This is expected to rarely happen, usually only for staging new signatures.
de7ddf
de7ddf
```yaml
de7ddf
default-docker:
de7ddf
    sigstore-staging: file:///mnt/company/common-sigstore-staging
de7ddf
```
de7ddf
de7ddf
# AUTHORS
de7ddf
de7ddf
Miloslav Trmač <mitr@redhat.com>