# Troubleshooting Container registry

Fixes for refused logins, pushes and pulls, scans that fail, and images that keep costing storage.

## `docker login` fails with 401

**Cause:** a wrong access key id or secret (`Invalid credentials`), or a login token that has
expired or was revoked (`Invalid or expired token`).

**Fix:** log in again with the access key id and its secret, or create a new login token (see
[Log in to the registry](log-in.md)).

## A push is refused: `token does not grant push on repository …`

**Cause:** the credential's policies do not allow `ecr:PushImage` on that repository, or, for a
name that has no repository yet, `ecr:CreateRepository`.

**Fix:** grant the permission, or create the repository first (see
[Create a repository](create-a-repository.md)).

## A pull is refused: `token does not grant pull on repository …`

**Cause:** the repository is private and the credential's policies do not allow `ecr:PullImage`
on it.

**Fix:** grant `ecr:PullImage` on that repository, or make the repository public.

## A push is refused: `tag "…" is immutable in this repository`

**Cause:** the repository's tags are immutable and the tag already names another image.

**Fix:** push a new tag, add the tag to the exclusions, or delete the tag first (see
[Make tags immutable](make-tags-immutable.md)).

## A push is refused: `storage quota exceeded`

**Cause:** the push would take the organization or the repository past its cap, or past the
registry storage quota.

**Fix:** delete images, or raise the cap or the quota (see
[Set a storage quota](set-a-storage-quota.md)).

## A scan stays pending or fails

**Cause:** the scanner gets up to 10 minutes per image before the scan fails, and the error is on
the scan report. A scan still pending or running well after that was interrupted and will not
finish.
A scan that **failed** with "Nothing to scan" found no operating system and no packages, as with
an image holding one static binary.

**Fix:** scan again from the image's row (see [Scan an image](scan-an-image.md)). "Nothing to
scan" is expected for such images.

## An image row says **untagged**

**Cause:** a later push moved the tag to another image; this one has no name left but still costs
storage.

**Fix:** pull it by digest if you still need it; otherwise delete it, or let a lifecycle rule for
untagged images do it.

## Deleting an untagged image returns `409`

**Cause:** a tag still points at that image.

**Fix:** delete the tag instead; the image goes with the last tag pointing at it.

## An image disappeared

**Cause:** a lifecycle rule deleted it.

**Fix:** restore it before it is purged (see [Restore an expired image](restore-an-expired-image.md)),
then keep it with a `keep` clause or a repository policy.

## The registry stores more than the repositories add up to

**Cause:** two kinds of layers are stored outside any repository: layers held only by images a
lifecycle rule deleted, kept while those images can still be restored, and layers no image uses
any more, which cleanup deletes 24 hours after an image last used them, or keeps while
Deutsche Cloud runs cleanup in report-only mode. The **Storage** page shows both.

**Fix:** none needed. Layers of deleted images count toward your bill but not your quota, until
they are purged; unused layers count toward neither (see
[Storage and cleanup](storage-and-cleanup.md)).
