From 0dede5c898cd10c13a59314be3c20e222b203019 Mon Sep 17 00:00:00 2001 From: rishabh Date: Mon, 23 Mar 2026 12:04:02 +0800 Subject: [PATCH] docs: add example for --list=variables with variable descriptions Signed-off-by: rishabh --- docs/reference/buildx_bake.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/reference/buildx_bake.md b/docs/reference/buildx_bake.md index 092a1d5cb..0dd0777fb 100644 --- a/docs/reference/buildx_bake.md +++ b/docs/reference/buildx_bake.md @@ -213,6 +213,24 @@ DEBUG bool false Add debug symbols Variable types will be shown when set using the `type` property in the Bake file. +The `--list=variables` option displays variables defined in the Bake file, including their descriptions and default values. + +### Example: listing variables with descriptions + +```hcl +variable "GO_VERSION" { + default = "1.22" + description = "Go version used for building the application" +} +``` + +```console +$ docker buildx bake --list=variables + +NAME DESCRIPTION DEFAULT +GO_VERSION Go version used for building the application 1.22 +``` + By default, the output of `docker buildx bake --list` is presented in a table format. Alternatively, you can use a long-form CSV syntax and specify a `format` attribute to output the list in JSON.