docker / hub-feedback

Feedback and bug reports for the Docker Hub
https://hub.docker.com
234 stars 39 forks source link

A feature request for being able to automate tagging images with a build date #2112

Closed gh-andre closed 2 years ago

gh-andre commented 3 years ago

Problem description

Docker images that are intended as build environments and contain only build tools and 3rd-party packages, such as C++ build images with GCC, make, and various library packages, need to be updated only when Dockerfile on their branch changes sufficiently to require another image build. This means that most of the time they are built manually, either locally and then pushed to Docker Hub or by clicking Trigger on Docker Hub. However, the latter requires that build configuration is removed and new one is added to accommodate new image tags, which is a bit of a hassle that can be avoided.

Docker images with build dependencies cannot be tagged with branch names because there can be different dependencies on the same branch on the way to some release. Consider the following timeline:

-----*------------*-----------*----------------*--------> master
   dep A        dep B       dep C           planned
 20210301     20210405    20210520           2.0.0

Within a few months I may introduce dependencies A, B and C and for each of them will build a Docker image that adds each dependency on the date mentioned. All of those images are intended for the upcoming release 2.0.0, but each is supposed to be pulled from image repository only when building source before the next image is created. So, for example, if I use git bisect, each build will be made with the correct Docker image

Using latest image doesn't work for this, as some dependencies may change in the way that makes them incompatible with earlier code (e.g. dependency A is updated to a newer version, so old source will break). Same goes for using release branch names, as there may be more than one build image with different dependencies for the same release branch. The only way to make it work reliably is to tag images with dates.

What I have been doing on the command line was to tag each new image with a date and add latest, for convenience, mostly, as it only works for manual references and not automated tools because a pipeline referring to latest in the past would pull the most updated image that wouldn't work with the source at that commit.

Recently I learned that Docker Hub allows combining tags, which isn't well documented, but works quite nicely, so having a tag 20210620,latest creates both tags after the build. This is nice because it saves the trouble of having to use the command line. However, tags in Docker Hub cannot be edited, so each time I need to update an image, I have to delete the configuration and add a new one with the current date, which is a bit of an unnecessary hassle.

If there was a special tag, something along the lines of {date}, which would resolve to the current date, maybe with an optional format, then one would have build tags configured as {date},latest and would just need to click Trigger to make a new build tagged with a date.

github-actions[bot] commented 2 years ago

We are clearing up our old issues and your ticket has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 15 days.

gh-andre commented 2 years ago

Wow. No wonder nothing gets done if you let your bot decide what gets into product and what gets dumped. Fine, no need to wait for 15 days. If you don't see the benefit in being able to build reliably off a tag, I will gladly close the issue.