Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add opencontainer labels to Docker images #2282

Open
RyanNgWH opened this issue Aug 23, 2024 · 2 comments
Open

Add opencontainer labels to Docker images #2282

RyanNgWH opened this issue Aug 23, 2024 · 2 comments

Comments

@RyanNgWH
Copy link

It would be great if the Docker container images had opencontainers labels. I have seen this across multiple other containers and believe this is the standard for labeling images.

https://github.com/opencontainers/image-spec/blob/main/annotations.md

Adding labels such as org.opencontainers.image.version will provide a way to obtain the current version of the running docker image which can be useful in automating the process of checking for updates.

Doing a docker inspect on the current images shows no labels. Here is an example of the Jellyfin docker image with opencontainers labels:

"Labels": {
    "org.opencontainers.image.description": "The Free Software Media System",
    "org.opencontainers.image.documentation": "https://jellyfin.org/docs/",
    "org.opencontainers.image.source": "https://github.com/jellyfin/jellyfin",
    "org.opencontainers.image.title": "Jellyfin",
    "org.opencontainers.image.url": "https://jellyfin.org",
    "org.opencontainers.image.version": "10.9.8"
}
@joshtrichards
Copy link
Member

Looks like some of the other Docker Official program images support this. It would require changes to our update script and possibly Dockerfile templates I guess.

MariaDB image's approach:

For us the equivalent would be somewhere around here:

  • docker/update.sh

    Lines 106 to 128 in e6d0240

    template="Dockerfile-${base[$variant]}.template"
    echo "# DO NOT EDIT: created by update.sh from $template" > "$dir/Dockerfile"
    cat "$template" >> "$dir/Dockerfile"
    echo "updating $fullversion [$1] $variant"
    # Replace the variables.
    sed -ri -e '
    s/%%ALPINE_VERSION%%/'"$alpineVersion"'/g;
    s/%%DEBIAN_VERSION%%/'"$debianVersion"'/g;
    s/%%PHP_VERSION%%/'"$phpVersion"'/g;
    s/%%VARIANT%%/'"$variant"'/g;
    s/%%VERSION%%/'"$fullversion"'/g;
    s/%%DOWNLOAD_URL%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$url")"'/g;
    s/%%DOWNLOAD_URL_ASC%%/'"$(sed -e 's/[\/&]/\\&/g' <<< "$ascUrl")"'/g;
    s/%%CMD%%/'"${cmd[$variant]}"'/g;
    s|%%VARIANT_EXTRAS%%|'"${extras[$variant]}"'|g;
    s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g;
    s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/g;
    s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g;
    s/%%IMAGICK_VERSION%%/'"${pecl_versions[imagick]}"'/g;
    s/%%CRONTAB_INT%%/'"$crontabInt"'/g;
    ' "$dir/Dockerfile"
  • Debian
  • Alpine

@joshtrichards joshtrichards changed the title Feature request: Add opencontainer labels to Docker images Add opencontainer labels to Docker images Oct 13, 2024
@J0WI
Copy link
Contributor

J0WI commented Oct 24, 2024

docker-library/official-images#3540 (comment)

This doesn't sound very encouraging

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants