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