feat: support long syntax for image names and build tags#13709
feat: support long syntax for image names and build tags#13709ssam18 wants to merge 1 commit intodocker:mainfrom
Conversation
This adds support for specifying image references using a map with name/tag/digest fields instead of a plain string, making it possible to use YAML anchors for version management in compose files. Depends on compose-spec/compose-go#NNN (ssam18/compose-go feat/image-long-syntax) Signed-off-by: Samaresh Kumar Singh <ssam3003@gmail.com>
e776ed4 to
61132b6
Compare
|
Thanks for the contribution. Before we can consider this, we'd need to understand what problem this solves that isn't already covered today. Variable interpolation already handles the use case shown in the PR description: services:
my:
image: myimage:${VERSION:-1.0.0}
build:
context: .
args:
VERSION: ${VERSION:-1.0.0}
tags:
- myimage:${VERSION:-1.0.0}
- myimage:latestThis is simpler, already works today, and comes with additional benefits that the long syntax doesn't offer:
Could you help us understand:
Adding a new syntax for image and build.tags has a cost, it touches the Compose Specification schema, the compose-go parsing library, and the compose CLI. Every tool and library that consumes Compose files would need to handle the new oneOf. So we'd need a clear justification for why existing mechanisms aren't sufficient. |
|
@glours - your point is valid! Variable interpolation already handles this better than what I proposed here. Not worth the added complexity to the spec and tooling. Closing this one out. |
Users can now write
imageas a map withname,tag, anddigestfields instead of a plain string. The same long syntax works for entries inbuild.tags, so a single YAML anchor can drive both the service image and the build tags without string interpolation tricks.The core parsing changes live in compose-spec/compose-go (see ssam18/compose-go feat/image-long-syntax); this PR wires in that dependency and adds loader-level tests. Once the upstream compose-go PR is merged and released, the replace directive here will be swapped for a normal version bump.
Example usage: