docker / docker/buildx

List of build-args and stages should be sorted alphabetically in `--call outline` and `--call targets` output

Open
#2,974 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/enhancement status/triage
Dominant language
Go
Stars
4.5k
Forks
682
Avg merge
2d 14h
Merged PRs (30d)
29

Description

Description

Output of --call outline and --call targets currently prints build-args and stages in the order in which they appear in the Dockerfile. This makes it harder to find specific targets or args in the list for more complex Dockerfiles;

docker build --call outline .
[+] Building 2.5s (9/9) FINISHED                                                                                     docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                 0.0s
 => => transferring dockerfile: 5.15kB                                                                                               0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1                                                            1.1s
 => [auth] docker/dockerfile:pull token for registry-1.docker.io                                                                     0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25      0.0s
 => => resolve docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25                 0.0s
 => [internal] load metadata for docker.io/tonistiigi/xx:1.6.1                                                                       1.2s
 => [internal] load metadata for docker.io/library/golang:1.23.6-alpine3.21                                                          0.7s
 => [auth] tonistiigi/xx:pull token for registry-1.docker.io                                                                         0.0s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                        0.0s
 => [internal] load .dockerignore                                                                                                    0.0s
 => => transferring context: 263B                                                                                                    0.0s
TARGET: binary

BUILD ARG               VALUE    DESCRIPTION
BASE_VARIANT            alpine
ALPINE_VERSION          3.21
GO_VERSION              1.23.6
XX_VERSION              1.6.1
GOVERSIONINFO_VERSION   v1.4.1
GO_LINKMODE             static   defines if static or dynamic binary should be produced
GO_BUILDTAGS                     defines additional build tags
GO_STRIP                         strips debugging symbols if set
CGO_ENABLED                      manually sets if cgo is used
VERSION                          sets the version for the produced binary
PACKAGER_NAME                    sets the company that produced the windows binary
docker build --call targets .
[+] Building 0.8s (3/3) FINISHED                                                                                     docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                 0.0s
 => => transferring dockerfile: 5.15kB                                                                                               0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1                                                            0.6s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25      0.0s
 => => resolve docker.io/docker/dockerfile:1@sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25                 0.0s
TARGET            DESCRIPTION
xx
build-base-alpine
build-alpine
build-base-debian
build-debian
goversioninfo
gotestsum
build
test
test-coverage
build-plugins
e2e-base-alpine
e2e-base-debian
buildx
compose
e2e
dev
plugins
bin-image-linux
bin-image-darwin
bin-image-windows
bin-image
binary (default)
What I'd like to see

Given that the order in which these appear in the Dockerfile is irrelevant to using them, we should consider sorting them alphabetically, possibly considering the (default) to be printed in a separate column.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the --call outline and --call targets output paths in the buildx source, then inspect any tests covering these listings. Confirm that build arguments and targets are alphabetized and that the default marker remains represented correctly; done when both commands produce deterministic sorted output.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.