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
[Feature Request] docker compose tag --template "template" --push #9051
Comments
related to docker#9051 Signed-off-by: abdennour <mail@abdennoor.com>
with --push option also it resolves docker#9051 Signed-off-by: abdennour <mail@abdennoor.com>
it solves docker#9051 Signed-off-by: abdennour <mail@abdennoor.com>
Would maintainers kindly take note of this good feature? |
Could you please clarify the uses cases for - {{ .ServicesCount }} / {{ .ServicesToBuildCount }} |
The use case is CI system has to push built images. |
I understand the global feature request to have additional/atlernative tags for image built by compose, I just wonder about the ServicesCount / ServicesToBuildCount variable you suggest. I don't feel the need for those, and they suggest a fragile design for deterministic image tags |
Oh! I see your point @ndeloof.
More real example: VERSION=v1.2.3
APP=myapp
docker compose tag --template "nexus.local/myrepo/{{ if eq .ServicesToBuildCount 1}}$APP{{ else }}$APP-{{ .ServiceName }}{{ end }}:$VERSION" --push |
I don't expect users would use From my own experience, users relying on compose for CI do tag images with my.registry/${PROJECT}:${SERVICE}:${GIT_SHA} to make it easy track which image has been built from a commit and run tests/deployments accordingly. |
@ndeloof let me know please what's your acceptance criteria ? |
Signed-off-by: atoumi <atoumi@elm.sa>
OK guys! WE released this feature from our fork. Feel free to use with caution as it's not the official compose. |
I'm not fully convinced by this approach. |
Any change in the mind ? any news t get this reviewed & merged ? |
@ndeloof Could you please check again? I am pretty sure you may be convinced now |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed because it had not recent activity during the stale period. |
Description
I would like to tag my built images, then, optionally, push these tags.
In CI environment, image tags are auto-calculated, and CI has to do some governance regardless the YAML definition of
.services{}.image
Poposal
Adding subcommand
docker compose tag
with the following options:--template string
: the tag template which can leverage the following variables :-
{{ .ServiceName }}
- service name under tagging-
{{ .ProjectName }}
- compose project name-
{{ .ServicesCount }}
- Total number of services-
{{ .ServicesToBuildCount }}
- Total number of services to build--push
: whether to push the new tag(s) or just taggingi.e.
docker compose tag --template "myregistry.local/myrepo/{{ .ServiceName }}:v1" --push
Scenario 1
Given a docker-compose file as following:
And given this script (After implementing this feature)
VERSION=v1.2.3 APP=myapp docker compose tag --template "nexus.local/myrepo/{{ if eq .ServicesToBuildCount 1}}$APP{{ else }}$APP-{{ .ServiceName }}{{ end }}:$VERSION" --push
Results:
nexus.local/myrepo/myapp-frontend:v1.2.3
is created & pushednexus.local/myrepo/myapp-backend:v1.2.3
is created & pushedThe text was updated successfully, but these errors were encountered: