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