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