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