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