Closed erikmd closed 1 year ago
Your image has the labels being set:
$ docker pull ocamlsf/learn-ocaml:master
$ docker image inspect --format='{{json .Config.Labels}}' ocamlsf/learn-ocaml:master | jq
{
"org.opencontainers.image.created": "2023-05-06T08:01:04Z",
"org.opencontainers.image.description": "learn-ocaml app manager",
"org.opencontainers.image.revision": "1584a08636eb4ddb875a2b7051f78dbc94bec9b3",
"org.opencontainers.image.source": "git://github.com/ocaml-sf/learn-ocaml.git",
"org.opencontainers.image.title": "learn-ocaml",
"org.opencontainers.image.url": "https://ocaml-sf.org/",
"org.opencontainers.image.vendor": "The OCaml Software Foundation",
"org.opencontainers.image.version": "master"
}
Ah OK, thanks @crazy-max!
I got confused because the labels dynamically added by the GH action did not show up here:
From your viewpoint, is it "better" to:
LABEL
s from the Dockerfile so that all labels are set by docker/build-push-action
docker/build-push-action
and pass them instead as build ARG
s, so that all labels have a corresponding line in the Docker Hub explorer etc.?
At first sight, I'd lean towards 2. (because even if there is no actual bug, it happens the current situation is a bit confusing w.r.t. the principle of least surprise); WDYT?
I got confused because the labels dynamically added by the GH action did not show up here:
This is expected if they are being set as user input (label flag).
From your viewpoint, is it "better" to:
It depends. IMO labels should only be set as input (label flag) and not in your Dockerfile except if some labels are required for the operability of your container.
In your case I think it's only additional metadata at build time so should just be set as input. LABELs from your Dockerfile might make sense if they are useful to organize images, automation, etc... Also it's recommended to combine them to prevent extra layers:
LABEL org.opencontainers.image.title="learn-ocaml" \
org.opencontainers.image.description="learn-ocaml app manager" \
org.opencontainers.image.url="https://ocaml-sf.org/" \
org.opencontainers.image.vendor="The OCaml Software Foundation"
Great! thanks @crazy-max for your feedback 👍
So I think we can close the issue.
Behaviour
I recently migrated from the very-old version v1 (with
add_git_labels: true
) to v4 (with these labels).However, none of these 4 labels is added in the image:
See also our downstream issue:
Configuration
Logs
logs_2143.zip