Image name contains invalid characters or format
This error means the name you are trying to give an image or tag is invalid. Image names have strict formatting rules: they must be lowercase, and can contain letters, numbers, hyphens, underscores, and periods, but cannot start with a special character.
- 1Using uppercase letters in the image name (e.g., 'my-registry/My-App').
- 2Including invalid special characters like '!' or '#x27; in the name or tag.
- 3The image name starts or ends with a separator like a period, hyphen, or underscore.
- 4The tag name is too long (max 128 characters).
Trying to tag an image with a name containing uppercase letters.
docker tag my-app:latest my-registry/MyFancyApp:1.0
expected output
Error response from daemon: invalid reference format: repository name must be lowercase
Fix 1
Use Lowercase for Image Names
WHEN The error message explicitly says 'repository name must be lowercase'.
# Corrected command docker tag my-app:latest my-registry/myfancyapp:1.0
Why this works
Adheres to the Docker standard for image repository naming.
Fix 2
Remove Invalid Characters
WHEN The name contains special characters other than '.', '_', or '-'.
# Original: myapp:version_! # Corrected command docker tag my-app:latest my-app:version-1
Why this works
Ensures the image name and tag only contain allowed characters.
✕ Try to force the invalid name.
The naming restrictions are enforced by Docker and container registries. There is no way to bypass them. The only solution is to use a valid name.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev