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