How do you keep a `latest` tag but still know which build it points to?
BeginnerScenarioMulti-stage builds, cache, tags and registries
Answer
Situation read → Operators need traceability.
What I'd do → Add OCI labels at build time:
LABEL org.opencontainers.image.revision=$GIT_SHA \
org.opencontainers.image.source=https://github.com/acme/app \
org.opencontainers.image.created=$BUILD_DATE
Then docker inspect -f '{{json .Config.Labels}}' app:latest. Or use docker/metadata-action to generate them.
Why → Labels travel with the image.
Interview tip → The org.opencontainers.image.* namespace is the standard.
More on Multi-stage builds, cache, tags and registries
Show a multi-stage Dockerfile for a Java Spring Boot app and explain what you gain.BeginnerCI rebuilds from scratch every run and takes 12 minutes. How do you bring it down?IntermediateYou tag every build `myapp:latest`. A rollback is requested. What happens?BeginnerHow do you promote an image from dev to prod registry without rebuilding?IntermediateDisk on the build server keeps filling up with images.BeginnerWhen do you use `--no-cache` and when is it a smell?Beginner