@@ -21,7 +21,7 @@ Build from a file
2121| [ ` --check ` ] ( #check ) | ` bool ` | | Shorthand for ` --call=check ` |
2222| ` -D ` , ` --debug ` | ` bool ` | | Enable debug logging |
2323| [ ` -f ` ] ( #file ) , [ ` --file ` ] ( #file ) | ` stringArray ` | | Build definition file |
24- | ` --list ` | ` string ` | | List targets or variables |
24+ | [ ` --list ` ] ( #list ) | ` string ` | | List targets or variables |
2525| ` --load ` | ` bool ` | | Shorthand for ` --set=*.output=type=docker ` |
2626| [ ` --metadata-file ` ] ( #metadata-file ) | ` string ` | | Write build result metadata to a file |
2727| [ ` --no-cache ` ] ( #no-cache ) | ` bool ` | | Do not use cache when building the image |
@@ -102,6 +102,42 @@ $ docker buildx bake -f docker-bake.dev.hcl db webapp-release
102102See the [ Bake file reference] ( https://docs.docker.com/build/bake/reference/ )
103103for more details.
104104
105+ ### <a name =" list " ></a > List targets and variables (--list)
106+
107+ The ` --list ` flag displays all available targets or variables in the Bake
108+ configuration, along with a description (if set using the ` description `
109+ property in the Bake file).
110+
111+ To list all targets:
112+
113+ ``` console {title="List targets"}
114+ $ docker buildx bake --list=targets
115+ TARGET DESCRIPTION
116+ binaries
117+ default binaries
118+ update-docs
119+ validate
120+ validate-golangci Validate .golangci.yml schema (does not run Go linter)
121+ ```
122+
123+ To list variables:
124+
125+ ``` console
126+ $ docker buildx bake --list=variables
127+ VARIABLE VALUE DESCRIPTION
128+ REGISTRY docker.io/username Registry and namespace
129+ IMAGE_NAME my-app Image name
130+ GO_VERSION <null>
131+ ```
132+
133+ By default, the output of ` docker buildx bake --list ` is presented in a table
134+ format. Alternatively, you can use a long-form CSV syntax and specify a
135+ ` format ` attribute to output the list in JSON.
136+
137+ ``` console
138+ $ docker buildx bake --list=type=targets,format=json
139+ ```
140+
105141### <a name =" metadata-file " ></a > Write build results metadata to a file (--metadata-file)
106142
107143Similar to [ ` buildx build --metadata-file ` ] ( buildx_build.md#metadata-file ) but
0 commit comments