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