This warning appears when Docker encounters the deprecated MAINTAINER instruction in your Dockerfile. Replace it with the LABEL instruction using the org.opencontainers.image.authors key to specify maintainer metadata following modern OCI standards.
The MAINTAINER instruction was historically used in Dockerfiles to specify the author or maintainer of an image. However, this instruction has been deprecated since Docker 1.13.0 in favor of the more flexible LABEL instruction. When Docker parses your Dockerfile and encounters MAINTAINER, it will display a deprecation warning. While the build may still succeed, the warning indicates you're using an outdated practice that may be removed in future Docker versions. The deprecation exists because LABEL provides a standardized, more powerful approach to image metadata. Unlike MAINTAINER (which only accepts a single string), LABEL supports arbitrary key-value pairs, follows the OCI (Open Container Initiative) specification, and can be easily queried using `docker inspect`.
First, find the MAINTAINER line in your Dockerfile. It typically appears near the top, after the FROM instruction:
FROM ubuntu:22.04
MAINTAINER John Doe <[email protected]>You can search for it with:
grep -n "MAINTAINER" DockerfileReplace the MAINTAINER instruction with LABEL using the standardized OCI key for author information.
Before (deprecated):
FROM ubuntu:22.04
MAINTAINER John Doe <[email protected]>After (recommended - OCI standard):
FROM ubuntu:22.04
LABEL org.opencontainers.image.authors="John Doe <[email protected]>"Alternative (simpler):
FROM ubuntu:22.04
LABEL maintainer="[email protected]"The OCI standard (org.opencontainers.image.authors) is preferred for maximum compatibility with container tools and registries.
If you have multiple maintainers, include them in a single LABEL:
LABEL org.opencontainers.image.authors="John Doe <[email protected]>, Jane Smith <[email protected]>"Or use multiple labels for different purposes:
LABEL org.opencontainers.image.authors="Team Name <[email protected]>"
LABEL org.opencontainers.image.vendor="Company Name"
LABEL org.opencontainers.image.url="https://github.com/company/project"While updating your Dockerfile, consider adding other useful OCI standard labels:
LABEL org.opencontainers.image.authors="[email protected]"
LABEL org.opencontainers.image.title="My Application"
LABEL org.opencontainers.image.description="A containerized web application"
LABEL org.opencontainers.image.version="1.0.0"
LABEL org.opencontainers.image.source="https://github.com/user/repo"
LABEL org.opencontainers.image.licenses="MIT"Or combine them in a single LABEL instruction:
LABEL org.opencontainers.image.authors="[email protected]" \
org.opencontainers.image.title="My Application" \
org.opencontainers.image.version="1.0.0"Rebuild your image to confirm the warning is gone:
docker build -t myimage:latest .You can verify the labels are set correctly:
docker inspect myimage:latest --format='{{json .Config.Labels}}' | jqOr without jq:
docker inspect myimage:latest | grep -A 10 '"Labels"'Run hadolint to check for other Dockerfile issues:
docker run --rm -i hadolint/hadolint < Dockerfile### OCI Image Specification Labels
The Open Container Initiative (OCI) defines standard label keys for container image metadata. Using these ensures compatibility across container runtimes and registries:
| Label | Purpose |
|-------|---------|
| org.opencontainers.image.authors | Contact details of maintainers |
| org.opencontainers.image.title | Human-readable title |
| org.opencontainers.image.description | Human-readable description |
| org.opencontainers.image.version | Version of the packaged software |
| org.opencontainers.image.source | URL to source code |
| org.opencontainers.image.licenses | License(s) under which contained software is distributed |
| org.opencontainers.image.vendor | Name of the distributing entity |
| org.opencontainers.image.created | Date and time on which the image was built (RFC 3339) |
### Dynamic Labels at Build Time
You can set labels dynamically using build arguments:
ARG BUILD_DATE
ARG VERSION
ARG VCS_REF
LABEL org.opencontainers.image.created="${BUILD_DATE}" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${VCS_REF}"Then build with:
docker build \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VERSION=1.0.0 \
--build-arg VCS_REF=$(git rev-parse --short HEAD) \
-t myimage:latest .### Querying Labels
Labels can be used to filter and organize images:
# Find images by author
docker images --filter "[email protected]"
# List all labels for an image
docker inspect --format='{{range $k, $v := .Config.Labels}}{{$k}}={{$v}}{{println}}{{end}}' myimage:latest### Why MAINTAINER Was Deprecated
The MAINTAINER instruction had several limitations:
1. Only supported a single string value
2. Not part of the OCI specification
3. Couldn't be filtered or queried easily
4. No standardized format for the value
5. Mixing author info with other metadata wasn't possible
LABEL solves all these issues while providing a standardized, extensible approach to image metadata.
dockerfile parse error line 5: unknown instruction: RRUN
How to fix 'unknown instruction' Dockerfile parse error in Docker
Error response from daemon: manifest for nginx:nonexistent not found: manifest unknown: manifest unknown
How to fix 'manifest for image:tag not found' in Docker
Error response from daemon: invalid reference format: repository name must be lowercase
How to fix 'repository name must be lowercase' in Docker
Error response from daemon: No such image
How to fix 'No such image' in Docker
Error response from daemon: Container is not running
How to fix 'Container is not running' when using docker exec