Docker Community Forums

Share and learn in the Docker community.

How to trigger automated builds of multiple tags of an image

dockerhub

(Naamunds) #1

I would like to trigger automated builds of multiple Docker tags of an image using a single HTTP POST request. I have not yet found a way to do that. Specifically, if I have a repo that has one Dockerfile for tags “preview” and “latest”, and another Dockerfile for tag “futures”, how would I programmatically trigger builds for both the “preview” and “latest” tags but not the “futures” tag?

Sending multiple HTTP POST requests back-to-back is not a good option because the requests could be throttled by DockerHub, in addition to performance concerns with sending multiple HTTP requests.

Based on the examples in the Build Triggers section in the Build Settings page of the repo, the four options are to trigger all tags, to trigger by Docker tag name, to trigger by source branch, or to trigger by source tag. All of my tags are in the same branch/tag in GitHub, so the last two options aren’t applicable. I played around with different syntaxes for specifying multiple Docker tag names using the second option, such as {“docker_tag”: “latest; preview”}, but I couldn’t find anything that worked.

Is this supported? If not, I think it would be a valuable feature, as it would allow more flexibility in the triggering of automated builds.


(Sébastien HOUZÉ) #2

I’m also interested to know if we can do that. @naamunds did you find any documentation about that since?


(Michael Simons) #3

@shouze, there was an issue logged on this - https://github.com/docker/hub-feedback/issues/634. There is a workaround mentioned in the issue - https://github.com/docker/hub-feedback/issues/384#issuecomment-197731025 - that involves using a post_push hook that you can use to create additional tags for the same image. It is not ideal which is often the case with workarounds :slight_smile: but it just may help solve your problem.


(Sébastien HOUZÉ) #4

Thank you for the workaround @msimons :wink: