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

Specify multiple tags per build #341

Closed
Kaixhin opened this issue Sep 11, 2015 · 38 comments
Closed

Specify multiple tags per build #341

Kaixhin opened this issue Sep 11, 2015 · 38 comments

Comments

@Kaixhin
Copy link

Kaixhin commented Sep 11, 2015

As per comments in moby/moby#4768, it would be handy to specify multiple tags for a specific build. For example, the most common case would be assigning both a version number (e.g. "7.5") and the "latest" tag. Another use case, as seen with Ubuntu images, is to have version numbers and names.

@nathan-osman
Copy link

👍 I'd love to see this as well

@soberstadt
Copy link

👍 please. This would greatly increase the speed of fetching our master and staging branches instead of having to look it up all the time.

@jeroenpeeters
Copy link

+1 I also want this feature for semantic versioning.

@mikehaertl
Copy link

@ChristopherBiscardi Now over a year later, is there any news on this? It's basically the only reason that prevents me from using automated builds. In most official repos it's standard to have aliases for latest like 5.6.1, 5.6 and 5 - but User repos can't do this.

@ChristopherBiscardi
Copy link
Contributor

Sorry @mikehaertl I don't work at Docker anymore and thus have no insight into their priorities. As for the official repos, they are pushed manually (thus you could achieve a similar effect through any CI provider, which is what I do now).

@mikehaertl
Copy link

@ChristopherBiscardi Oh, ok. Thanks for the update. But with a CI provider I still can't use the "automated build" repo on docker hub, right? Thing is, that they privilege those in their search results. So if you don't have an automated build repo, your public repo is listed quite at the end somewhere.

@ChristopherBiscardi
Copy link
Contributor

@mikehaertl I'm not sure what qualifies as "Automated Build" anymore. I just tested pushing to an automated build repo I own under the test tag. It worked, so apparently you can do that (I also noticed my repo had been pushed to 2 days ago, which I definitely didn't do, so maybe base image updates are part of auto-builds now?).

Presumably you could fire a webhook when an Automated Build happens which triggers your CI platform of choice to pull the image, retag and push.

@mikehaertl
Copy link

From here

Automated build repositories rely entirely on the integration with your code repository. You cannot push to these image repositories using the docker push command.

In my understanding that's because an automated build should ensure, that you can always check the sources of the build. Whereas if you push a build, the user will not know if there isn't malware included etc. That's why automated build are favoured when searching on docker hub.

I don't know, why you where able to push to that repo, but given the above you shouldn't - maybe some permissive remains from your days at docker ;) ?

@pkennedyr
Copy link
Contributor

Thanks for the feedback. We are in the process of adding support for specifying multiple tags from a single build, which will be available on Docker Cloud later this year.

In the meantime, a workaround for pushing multiple tags from a single build on Docker Cloud is to use a post_push hook with the following commands:

docker tag $IMAGE_NAME $DOCKER_REPO:your_extra_tag
docker push $DOCKER_REPO:your_extra_tag

For more information on using hooks and running custom commands between phases of the build process, please see: https://docs.docker.com/docker-cloud/builds/advanced/

@mikehaertl
Copy link

@pkennedyr But will this work with automated builds? As quoted above the docs say, you can not push to an "automated build" repo.

@pkennedyr
Copy link
Contributor

@mikehaertl: Yes, the above workaround will work for automated builds - the doc is being updated to reflect that pushes are allowed on automated repositories. Apologies for the confusion.

@Hronom
Copy link

Hronom commented Nov 28, 2016

Can't wait for this feature!

@pchico83
Copy link

pchico83 commented Nov 28, 2016

Multi tags are already supported in both, Hub and Docker Cloud. You can specify tags separated by commas like:

          latest,5.6

@Hronom
Copy link

Hronom commented Nov 28, 2016

@pchico83 you mean I can do something like this:

{sourceref},latest

?

@pchico83
Copy link

@Hronom Yes, you can use any supported regexp for every tag separated by commas.
I have tested it in Docker Cloud, but it should also work in Hub.

@Hronom
Copy link

Hronom commented Nov 28, 2016

@pchico83 awesome, thanks, I'm also look now at docker cloud...
I think some example in the View example build rules will be helpful for newcomers like me.

@pchico83
Copy link

@Hronom Thanks. Yes, I opened a doc issue last week to document all this.

@Kaixhin
Copy link
Author

Kaixhin commented Nov 28, 2016

Any known issues with the Hub? I just tried 8.0,latest, and got the following:
8.0,latest: Invalid 'name' field: Illegal Docker tag character ',' at position 4. Valid values are ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$

@pchico83
Copy link

@Kaixhin Looks like it is not supported in Hub. I would recommend to switch to Docker Cloud.
https://forums.docker.com/t/future-updates-on-docker-hub-docker-cloud/20498

@Kaixhin
Copy link
Author

Kaixhin commented Nov 28, 2016

@pchico83 If this is not going to be added to the Hub would you be able to add the wontfix label to this issue?

@pkennedyr
Copy link
Contributor

pkennedyr commented Nov 29, 2016

Support for specifying multiple tags from a single build is now available in Docker Cloud. We encourage you to try out Docker Cloud as this is where you will find support for specifying multiple tags per build and many other auto-build features.

Also, marking this thread as won't fix since product development is currently focused on Docker Cloud: https://forums.docker.com/t/future-updates-on-docker-hub-docker-cloud/20498

@MichaelSimons
Copy link

@pkennedyr, Please accept my apologies in advance if I missed something in the Docker Cloud documentation or something obvious. How do you configure a single build rule for building multiple tags?

@pkennedyr
Copy link
Contributor

@MichaelSimons To specify multiple Docker Tags from a single build rule on Docker Cloud:

  1. Navigate to a automated build repository (i.e. configured with a source provider)
  2. Click the Builds tab
  3. Click Configure automated builds
  4. In the Build Rules section, enter the desired tag name(s) in the Docker Tag field (separated by a comma without spaces)

e.g. latest,1.1 or {sourceref},latest

Note: We will be updating the Docker Cloud documentation shortly to provide further context and examples of how to use this feature.

@MichaelSimons
Copy link

@pkennedyr, I was close with the syntax I was trying - I mistakenly had a space after the comma. Little surprised the space isn't ignored. Thanks for clarification!

collivier added a commit to collivier/functest that referenced this issue Sep 27, 2017
It allows creating the stable tags as allowed by Docker hub [1].

[1] docker/hub-feedback#341

Change-Id: I84909b20fc8b926eb5414db7d57100aaa6060f84
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
collivier added a commit to collivier/functest that referenced this issue Sep 27, 2017
It allows creating the stable tags as allowed by Docker hub [1].

[1] docker/hub-feedback#341

Change-Id: I84909b20fc8b926eb5414db7d57100aaa6060f84
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
collivier added a commit to collivier/functest that referenced this issue Sep 27, 2017
It allows creating the stable tags as allowed by Docker hub [1].

[1] docker/hub-feedback#341

Change-Id: I84909b20fc8b926eb5414db7d57100aaa6060f84
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
opnfv-github pushed a commit to opnfv/opnfvdocs that referenced this issue Sep 28, 2017
* Update docs/submodules/functest from branch 'stable/euphrates'
  - Add post_push hooks
    
    It allows creating the stable tags as allowed by Docker hub [1].
    
    [1] docker/hub-feedback#341
    
    Change-Id: I84909b20fc8b926eb5414db7d57100aaa6060f84
    Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
@klakegg
Copy link

klakegg commented Jan 23, 2018

I tried using this feature:

Docker Tag Name:
{sourceref},{sourceref}-busybox-latest

Error:
{sourceref},{sourceref}-busybox-latest: Invalid 'name' field: Illegal Docker tag character ',' at position 12. Valid values are ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$

The documentation is quite clear regarding use of comma to support multiple tags per build.

Please advice.

@WoZ
Copy link

WoZ commented Feb 26, 2018

I see the same issue

@bananajamma
Copy link

Still doesn't work with a comma; the documentation states it should.

mulcahys added a commit to HewlettPackard/zing-stats that referenced this issue Sep 26, 2018
Cannot seem to tag and push more than one image in the docker automated
build hook.

docker/hub-feedback#341 (comment)
suggests pushing a second image (latest in our case) from the post_push
hook as a workaround.
mulcahys added a commit to HewlettPackard/zing-stats that referenced this issue Sep 26, 2018
Cannot seem to tag and push more than one image in the docker automated
build hook.

docker/hub-feedback#341 (comment)
suggests pushing a second image (latest in our case) from the post_push
hook as a workaround.
@nSimonFR
Copy link

nSimonFR commented Oct 2, 2018

As I was have having the same problem, I have switched to Docker Cloud; no issue since.

@kelson42
Copy link

@pkennedyr Why this ticket is still closed if if it obvious it does not work on cloud.docker.com? I have "latest,1.6" and I get the infamous Invalid 'name' field: Illegal Docker tag character ',' at position 7. Valid values are ^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$

@mark-r-m
Copy link

mark-r-m commented Jul 18, 2019

Docker Hub and Docker Cloud should both seamlessly support multiple tags, like "latest,{\1}.{\2}.{\3},{\1}.{\2},{\1}" - that's the most common use case for both! I understand the Cloud is where Docker want us to go, but for those of us staying on Hub, you really should support this too.

@imtbl
Copy link

imtbl commented Oct 8, 2019

This does not to seem to work on Docker Cloud as advertised either.

Trying to save an automated build with the Docker tag set to something like {sourceref},latest just keeps {sourceref} for me without showing any error.

@samhwang
Copy link

Just tested this again today and this feature is not on Docker Cloud, as advertised. I set up an automated build rule, with source branch master, with result tags 7.3 and latest. When I click save, it just saves to 7.3, without popping up any error messages at all.

Settings:
image

Saved:
image

@baztian
Copy link

baztian commented Nov 8, 2019

For me specifying latest,{sourceref} works.

@imtbl
Copy link

imtbl commented Nov 8, 2019

@baztian

Interesting, thank you. Maybe it's the order (latest first)? I will give this a try myself later.
Edit: I can confirm this working for me as well, both when using latest,{sourceref} and also when using something like latest,{\1}.

@anton-yurchenko
Copy link

For those who are still Googling, this works for me on https://hub.docker.com

image

@ulope
Copy link

ulope commented Jun 22, 2020

Can someone using this 'hack' confirm it still works?
Using this configuration:

Always fails when pushing with

Successfully built a46fcc079028
Successfully tagged raidennetwork/raiden:latest
Pushing index.docker.io/raidennetwork/raiden:latest...
Push failed. Attempt 2 in 60 seconds.
Push failed. Attempt 3 in 60 seconds.
Push failed. Attempt 4 in 60 seconds.
Push failed. Attempt 5 in 60 seconds.
{u'message': u'tag does not exist: raidennetwork/raiden:v1.1.0'}

The missing tag is always the second one. If I switch the order of latest and {sourceref} the message complains about latest being the missing tag.

@HendrikRoehm
Copy link

Hi @ulope

the problem might be with the sourceref variable. It worked for me on docker hub with
image

@ulope
Copy link

ulope commented Jul 13, 2020

@HendrikRoehm Ok thanks for the feedback. Will try that syntax.

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