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