invalid reference format: repository name must be lowercase
Fixes 'repository name must be lowercase' when docker rejects an image name with uppercase letters. Use when build, tag, push, or run fail specifically on case. Not for the generic invalid reference format from other bad characters.
TL;DR: Lowercase the image name. docker build -t MyApp:latest becomes docker build -t myapp:latest, and the same for tag, push, and run. Docker Hub namespaces and repository names are lowercase-only by rule, and the daemon enforces it at parse time.
The error
invalid reference format: repository name must be lowercaseFix it
- Lowercase the repository portion (everything before the
:tag):
docker tag MyApp:latest myregistry/myapp:latest Expected: succeeds.
- If the name comes from a CI variable (repo name, branch), normalize it in the pipeline, e.g. pipe through a lowercase transform before passing to docker.
- Re-run the original command with the lowercased name.
When this applies
- Any docker command failing with this exact message
- GitHub org/repo names with capitals interpolated into image tags in CI
When this does NOT apply
- Generic "invalid reference format" with no lowercase mention (different bad character)
- Push rejections from the registry after the name parsed fine (auth/permission instead)
Versions
All Docker versions.
Why it happens
The distribution spec defines repository names as lowercase. The daemon validates the reference before contacting any registry, so even purely local builds fail fast on uppercase.
Edge cases
- The TAG portion may contain uppercase (
myapp:MyTagis legal); only the repository name must be lowercase. docker pull MyAppfails the same way even though you are only reading; validation happens client-side first.