bb3e91
% containers-auth.json 5
bb3e91
bb3e91
# NAME
bb3e91
containers-auth.json - syntax for the registry authentication file
bb3e91
bb3e91
# DESCRIPTION
bb3e91
bb3e91
A credentials file in JSON format used to authenticate against container image registries.
bb3e91
The primary (read/write) file is stored at `${XDG_RUNTIME_DIR}/containers/auth.json` on Linux;
bb3e91
on Windows and macOS, at `$HOME/.config/containers/auth.json`.
bb3e91
bb3e91
When searching for the credential for a registry, the following files will be read in sequence until the valid credential is found:
bb3e91
first reading the primary (read/write) file, or the explicit override using an option of the calling application.
bb3e91
If credentials are not present, search in `${XDG_CONFIG_HOME}/containers/auth.json` (usually `~/.config/containers/auth.json`), `$HOME/.docker/config.json`, `$HOME/.dockercfg`.
bb3e91
bb3e91
Except the primary (read/write) file, other files are read-only, unless the user use an option of the calling application explicitly points at it as an override.
bb3e91
bb3e91
bb3e91
## FORMAT
bb3e91
bb3e91
The auth.json file stores encrypted authentication information for the
bb3e91
user to container image registries.  The file can have zero to many entries and
bb3e91
is created by a `login` command from a container tool such as `podman login`,
bb3e91
`buildah login` or `skopeo login`. Each entry either contains a single
bb3e91
hostname (e.g. `docker.io`) or a namespace (e.g. `quay.io/user/image`) as a key
bb3e91
and an auth token in the form of a base64 encoded string as value of `auth`. The
bb3e91
token is built from the concatenation of the username, a colon, and the
bb3e91
password. The registry name can additionally contain a repository name (an image
bb3e91
name without tag or digest) and namespaces. The path (or namespace) is matched
bb3e91
in its hierarchical order when checking for available authentications. For
bb3e91
example, an image pull for `my-registry.local/namespace/user/image:latest` will
bb3e91
result in a lookup in `auth.json` in the following order:
bb3e91
bb3e91
- `my-registry.local/namespace/user/image`
bb3e91
- `my-registry.local/namespace/user`
bb3e91
- `my-registry.local/namespace`
bb3e91
- `my-registry.local`
bb3e91
bb3e91
This way it is possible to setup multiple credentials for a single registry
bb3e91
which can be distinguished by their path.
bb3e91
bb3e91
The following example shows the values found in auth.json after the user logged in to
bb3e91
their accounts on quay.io and docker.io:
bb3e91
bb3e91
```
bb3e91
{
bb3e91
	"auths": {
bb3e91
		"docker.io": {
bb3e91
			"auth": "erfi7sYi89234xJUqaqxgmzcnQ2rRFWM5aJX0EC="
bb3e91
		},
bb3e91
		"quay.io": {
bb3e91
			"auth": "juQAqGmz5eR1ipzx8Evn6KGdw8fEa1w5MWczmgY="
bb3e91
		}
bb3e91
	}
bb3e91
}
bb3e91
```
bb3e91
bb3e91
This example demonstrates how to use multiple paths for a single registry, while
bb3e91
preserving a fallback for `my-registry.local`:
bb3e91
bb3e91
```
bb3e91
{
bb3e91
	"auths": {
bb3e91
		"my-registry.local/foo/bar/image": {
bb3e91
			"auth": "…"
bb3e91
		},
bb3e91
		"my-registry.local/foo": {
bb3e91
			"auth": "…"
bb3e91
		},
bb3e91
		"my-registry.local": {
bb3e91
			"auth": "…"
bb3e91
		},
bb3e91
	}
bb3e91
}
bb3e91
```
bb3e91
bb3e91
An entry can be removed by using a `logout` command from a container
bb3e91
tool such as `podman logout` or `buildah logout`.
bb3e91
bb3e91
In addition, credential helpers can be configured for specific registries and the credentials-helper
bb3e91
software can be used to manage the credentials in a more secure way than depending on the base64 encoded authentication
bb3e91
provided by `login`.  If the credential helpers are configured for specific registries, the base64 encoded authentication will not be used
bb3e91
for operations concerning credentials of the specified registries.
bb3e91
bb3e91
When the credential helper is in use on a Linux platform, the auth.json file would contain keys that specify the registry domain, and values that specify the suffix of the program to use (i.e. everything after docker-credential-).  For example:
bb3e91
bb3e91
```
bb3e91
{
bb3e91
    "auths": {
bb3e91
        "localhost:5001": {}
bb3e91
    },
bb3e91
    "credHelpers": {
bb3e91
		"registry.example.com": "secretservice"
bb3e91
	}
bb3e91
}
bb3e91
```
bb3e91
bb3e91
For more information on credential helpers, please reference the [GitHub docker-credential-helpers project](https://github.com/docker/docker-credential-helpers/releases).
bb3e91
bb3e91
# SEE ALSO
bb3e91
    buildah-login(1), buildah-logout(1), podman-login(1), podman-logout(1), skopeo-login(1), skopeo-logout(1)
bb3e91
bb3e91
# HISTORY
bb3e91
Feb 2020, Originally compiled by Tom Sweeney <tsweeney@redhat.com>