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