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