diff --git a/_data/buildx/docker_buildx.yaml b/_data/buildx/docker_buildx.yaml index d03487be85..e1dfbb34f8 100644 --- a/_data/buildx/docker_buildx.yaml +++ b/_data/buildx/docker_buildx.yaml @@ -4,46 +4,46 @@ long: Extended build capabilities with BuildKit pname: docker plink: docker.yaml cname: -- docker buildx bake -- docker buildx build -- docker buildx create -- docker buildx du -- docker buildx imagetools -- docker buildx inspect -- docker buildx ls -- docker buildx prune -- docker buildx rm -- docker buildx stop -- docker buildx use -- docker buildx version + - docker buildx bake + - docker buildx build + - docker buildx create + - docker buildx du + - docker buildx imagetools + - docker buildx inspect + - docker buildx ls + - docker buildx prune + - docker buildx rm + - docker buildx stop + - docker buildx use + - docker buildx version clink: -- docker_buildx_bake.yaml -- docker_buildx_build.yaml -- docker_buildx_create.yaml -- docker_buildx_du.yaml -- docker_buildx_imagetools.yaml -- docker_buildx_inspect.yaml -- docker_buildx_ls.yaml -- docker_buildx_prune.yaml -- docker_buildx_rm.yaml -- docker_buildx_stop.yaml -- docker_buildx_use.yaml -- docker_buildx_version.yaml + - docker_buildx_bake.yaml + - docker_buildx_build.yaml + - docker_buildx_create.yaml + - docker_buildx_du.yaml + - docker_buildx_imagetools.yaml + - docker_buildx_inspect.yaml + - docker_buildx_ls.yaml + - docker_buildx_prune.yaml + - docker_buildx_rm.yaml + - docker_buildx_stop.yaml + - docker_buildx_use.yaml + - docker_buildx_version.yaml options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - You can also use the `BUILDX_BUILDER` environment variable. + You can also use the `BUILDX_BUILDER` environment variable. deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_bake.yaml b/_data/buildx/docker_buildx_bake.yaml index 88daea3e0b..af05e9180b 100644 --- a/_data/buildx/docker_buildx_bake.yaml +++ b/_data/buildx/docker_buildx_bake.yaml @@ -1,1070 +1,248 @@ command: docker buildx bake -aliases: f +aliases: docker buildx bake, docker buildx f short: Build from a file long: |- - Bake is a high-level build command. Each specified target will run in parallel - as part of the build. + Bake is a high-level build command. Each specified target will run in parallel + as part of the build. - Read [High-level build options](https://github.com/docker/buildx#high-level-build-options) - for introduction. + Read [High-level build options with Bake](/build/bake/) + guide for introduction to writing bake files. - Please note that `buildx bake` command may receive backwards incompatible - features in the future if needed. We are looking for feedback on improving the - command and extending the functionality further. + > **Note** + > + > `buildx bake` command may receive backwards incompatible features in the future + > if needed. We are looking for feedback on improving the command and extending + > the functionality further. usage: docker buildx bake [OPTIONS] [TARGET...] pname: docker buildx plink: docker_buildx.yaml options: -- option: file - shorthand: f - value_type: stringArray - default_value: '[]' - description: Build definition file - details_url: '#file' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: load - value_type: bool - default_value: "false" - description: Shorthand for `--set=*.output=type=docker` - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: metadata-file - value_type: string - description: Write build result metadata to the file - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: no-cache - value_type: bool - default_value: "false" - description: Do not use cache when building the image - details_url: '#no-cache' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: print - value_type: bool - default_value: "false" - description: Print the options without building - details_url: '#print' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: progress - value_type: string - default_value: auto - description: | - Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output - details_url: '#progress' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: pull - value_type: bool - default_value: "false" - description: Always attempt to pull all referenced images - details_url: '#pull' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: push - value_type: bool - default_value: "false" - description: Shorthand for `--set=*.output=type=registry` - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: set - value_type: stringArray - default_value: '[]' - description: Override target value (e.g., `targetpattern.key=value`) - details_url: '#set' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: file + shorthand: f + value_type: stringArray + default_value: '[]' + description: Build definition file + details_url: '#file' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: load + value_type: bool + default_value: "false" + description: Shorthand for `--set=*.output=type=docker` + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: metadata-file + value_type: string + description: Write build result metadata to the file + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: no-cache + value_type: bool + default_value: "false" + description: Do not use cache when building the image + details_url: '#no-cache' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: print + value_type: bool + default_value: "false" + description: Print the options without building + details_url: '#print' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: progress + value_type: string + default_value: auto + description: | + Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output + details_url: '#progress' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: pull + value_type: bool + default_value: "false" + description: Always attempt to pull all referenced images + details_url: '#pull' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: push + value_type: bool + default_value: "false" + description: Shorthand for `--set=*.output=type=registry` + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: set + value_type: stringArray + default_value: '[]' + description: Override target value (e.g., `targetpattern.key=value`) + details_url: '#set' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). - ### Specify a build definition file (-f, --file) {#file} + ### Specify a build definition file (-f, --file) {#file} - By default, `buildx bake` looks for build definition files in the current - directory, the following are parsed: + Use the `-f` / `--file` option to specify the build definition file to use. + The file can be an HCL, JSON or Compose file. If multiple files are specified + they are all read and configurations are combined. - - `docker-compose.yml` - - `docker-compose.yaml` - - `docker-bake.json` - - `docker-bake.override.json` - - `docker-bake.hcl` - - `docker-bake.override.hcl` + You can pass the names of the targets to build, to build only specific target(s). + The following example builds the `db` and `webapp-release` targets that are + defined in the `docker-bake.dev.hcl` file: - Use the `-f` / `--file` option to specify the build definition file to use. The - file can be a Docker Compose, JSON or HCL file. If multiple files are specified - they are all read and configurations are combined. - - The following example uses a Docker Compose file named `docker-compose.dev.yaml` - as build definition file, and builds all targets in the file: - - ```console - $ docker buildx bake -f docker-compose.dev.yaml - - [+] Building 66.3s (30/30) FINISHED - => [frontend internal] load build definition from Dockerfile 0.1s - => => transferring dockerfile: 36B 0.0s - => [backend internal] load build definition from Dockerfile 0.2s - => => transferring dockerfile: 3.73kB 0.0s - => [database internal] load build definition from Dockerfile 0.1s - => => transferring dockerfile: 5.77kB 0.0s - ... - ``` - - Pass the names of the targets to build, to build only specific target(s). The - following example builds the `backend` and `database` targets that are defined - in the `docker-compose.dev.yaml` file, skipping the build for the `frontend` - target: - - ```console - $ docker buildx bake -f docker-compose.dev.yaml backend database - - [+] Building 2.4s (13/13) FINISHED - => [backend internal] load build definition from Dockerfile 0.1s - => => transferring dockerfile: 81B 0.0s - => [database internal] load build definition from Dockerfile 0.2s - => => transferring dockerfile: 36B 0.0s - => [backend internal] load .dockerignore 0.3s - ... - ``` - - You can also use a remote `git` bake definition: - - ```console - $ docker buildx bake "https://github.com/docker/cli.git#v20.10.11" --print - #1 [internal] load git source https://github.com/docker/cli.git#v20.10.11 - #1 0.745 e8f1871b077b64bcb4a13334b7146492773769f7 refs/tags/v20.10.11 - #1 2.022 From https://github.com/docker/cli - #1 2.022 * [new tag] v20.10.11 -> v20.10.11 - #1 DONE 2.9s - { - "group": { - "default": { - "targets": [ - "binary" - ] - } - }, - "target": { - "binary": { - "context": "https://github.com/docker/cli.git#v20.10.11", - "dockerfile": "Dockerfile", - "args": { - "BASE_VARIANT": "alpine", - "GO_STRIP": "", - "VERSION": "" - }, - "target": "binary", - "platforms": [ - "local" - ], - "output": [ - "build" - ] - } - } - } - ``` - - As you can see the context is fixed to `https://github.com/docker/cli.git` even if - [no context is actually defined](https://github.com/docker/cli/blob/2776a6d694f988c0c1df61cad4bfac0f54e481c8/docker-bake.hcl#L17-L26) - in the definition. - - If you want to access the main context for bake command from a bake file - that has been imported remotely, you can use the `BAKE_CMD_CONTEXT` builtin var: - - ```console - $ cat https://raw.githubusercontent.com/tonistiigi/buildx/remote-test/docker-bake.hcl - target "default" { - context = BAKE_CMD_CONTEXT - dockerfile-inline = < [4/4] RUN ls -l && stop: - #8 0.101 total 0 - #8 0.102 -rw-r--r-- 1 root root 0 Jul 27 18:47 bar - #8 0.102 -rw-r--r-- 1 root root 0 Jul 27 18:47 foo - #8 0.102 /bin/sh: stop: not found - ``` - - ```console - $ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "https://github.com/docker/cli.git#v20.10.11" --print - #1 [internal] load git source https://github.com/tonistiigi/buildx.git#remote-test - #1 0.429 577303add004dd7efeb13434d69ea030d35f7888 refs/heads/remote-test - #1 CACHED - { - "target": { - "default": { - "context": "https://github.com/docker/cli.git#v20.10.11", - "dockerfile": "Dockerfile", - "dockerfile-inline": "FROM alpine\nWORKDIR /src\nCOPY . .\nRUN ls -l \u0026\u0026 stop\n" - } - } - } - ``` - - ```console - $ docker buildx bake "https://github.com/tonistiigi/buildx.git#remote-test" "https://github.com/docker/cli.git#v20.10.11" - ... - > [4/4] RUN ls -l && stop: - #8 0.136 drwxrwxrwx 5 root root 4096 Jul 27 18:31 kubernetes - #8 0.136 drwxrwxrwx 3 root root 4096 Jul 27 18:31 man - #8 0.136 drwxrwxrwx 2 root root 4096 Jul 27 18:31 opts - #8 0.136 -rw-rw-rw- 1 root root 1893 Jul 27 18:31 poule.yml - #8 0.136 drwxrwxrwx 7 root root 4096 Jul 27 18:31 scripts - #8 0.136 drwxrwxrwx 3 root root 4096 Jul 27 18:31 service - #8 0.136 drwxrwxrwx 2 root root 4096 Jul 27 18:31 templates - #8 0.136 drwxrwxrwx 10 root root 4096 Jul 27 18:31 vendor - #8 0.136 -rwxrwxrwx 1 root root 9620 Jul 27 18:31 vendor.conf - #8 0.136 /bin/sh: stop: not found - ``` - - ### Do not use cache when building the image (--no-cache) {#no-cache} - - Same as `build --no-cache`. Do not use cache when building the image. - - ### Print the options without building (--print) {#print} - - Prints the resulting options of the targets desired to be built, in a JSON - format, without starting a build. - - ```console - $ docker buildx bake -f docker-bake.hcl --print db - { - "group": { - "default": { - "targets": [ - "db" - ] - } - }, - "target": { - "db": { - "context": "./", - "dockerfile": "Dockerfile", - "tags": [ - "docker.io/tiborvass/db" - ] - } - } - } - ``` - - ### Set type of progress output (--progress) {#progress} - - Same as [`build --progress`](buildx_build.md#progress). Set type of progress - output (auto, plain, tty). Use plain to show container output (default "auto"). - - > You can also use the `BUILDKIT_PROGRESS` environment variable to set its value. - - The following example uses `plain` output during the build: - - ```console - $ docker buildx bake --progress=plain - - #2 [backend internal] load build definition from Dockerfile.test - #2 sha256:de70cb0bb6ed8044f7b9b1b53b67f624e2ccfb93d96bb48b70c1fba562489618 - #2 ... - - #1 [database internal] load build definition from Dockerfile.test - #1 sha256:453cb50abd941762900a1212657a35fc4aad107f5d180b0ee9d93d6b74481bce - #1 transferring dockerfile: 36B done - #1 DONE 0.1s - ... - ``` - - ### Always attempt to pull a newer version of the image (--pull) {#pull} - - Same as `build --pull`. - - ### Override target configurations from command line (--set) {#set} - - ``` - --set targetpattern.key[.subkey]=value - ``` - - Override target configurations from command line. The pattern matching syntax - is defined in https://golang.org/pkg/path/#Match. - - ```console - $ docker buildx bake --set target.args.mybuildarg=value - $ docker buildx bake --set target.platform=linux/arm64 - $ docker buildx bake --set foo*.args.mybuildarg=value # overrides build arg for all targets starting with 'foo' - $ docker buildx bake --set *.platform=linux/arm64 # overrides platform for all targets - $ docker buildx bake --set foo*.no-cache # bypass caching only for targets starting with 'foo' - ``` - - Complete list of overridable fields: - `args`, `cache-from`, `cache-to`, `context`, `dockerfile`, `labels`, `no-cache`, - `output`, `platform`, `pull`, `secrets`, `ssh`, `tags`, `target` - - ### File definition - - In addition to compose files, bake supports a JSON and an equivalent HCL file - format for defining build groups and targets. - - A target reflects a single docker build invocation with the same options that - you would specify for `docker build`. A group is a grouping of targets. - - Multiple files can include the same target and final build options will be - determined by merging them together. - - In the case of compose files, each service corresponds to a target. - - A group can specify its list of targets with the `targets` option. A target can - inherit build options by setting the `inherits` option to the list of targets or - groups to inherit from. - - Note: Design of bake command is work in progress, the user experience may change - based on feedback. - - HCL definition example: - - ```hcl - group "default" { + ```hcl + # docker-bake.dev.hcl + group "default" { targets = ["db", "webapp-dev"] - } + } - target "webapp-dev" { + target "webapp-dev" { dockerfile = "Dockerfile.webapp" tags = ["docker.io/username/webapp"] - } + } - target "webapp-release" { + target "webapp-release" { inherits = ["webapp-dev"] platforms = ["linux/amd64", "linux/arm64"] - } + } - target "db" { + target "db" { dockerfile = "Dockerfile.db" tags = ["docker.io/username/db"] - } - ``` + } + ``` - Complete list of valid target fields: + ```console + $ docker buildx bake -f docker-bake.dev.hcl db webapp-release + ``` - `args`, `cache-from`, `cache-to`, `context`, `contexts`, `dockerfile`, `inherits`, `labels`, - `no-cache`, `no-cache-filter`, `output`, `platform`, `pull`, `secrets`, `ssh`, `tags`, `target` + See our [file definition](/build/bake/file-definition/) + guide for more details. - ### Global scope attributes + ### Do not use cache when building the image (--no-cache) {#no-cache} - You can define global scope attributes in HCL/JSON and use them for code reuse - and setting values for variables. This means you can do a "data-only" HCL file - with the values you want to set/override and use it in the list of regular - output files. + Same as `build --no-cache`. Do not use cache when building the image. - ```hcl - # docker-bake.hcl - variable "FOO" { - default = "abc" - } + ### Print the options without building (--print) {#print} - target "app" { - args = { - v1 = "pre-${FOO}" - } - } - ``` + Prints the resulting options of the targets desired to be built, in a JSON + format, without starting a build. - You can use this file directly: - - ```console - $ docker buildx bake --print app - { - "group": { - "default": { - "targets": [ - "app" - ] - } - }, - "target": { - "app": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "v1": "pre-abc" + ```console + $ docker buildx bake -f docker-bake.hcl --print db + { + "group": { + "default": { + "targets": [ + "db" + ] } - } - } - } - ``` - - Or create an override configuration file: - - ```hcl - # env.hcl - WHOAMI="myuser" - FOO="def-${WHOAMI}" - ``` - - And invoke bake together with both of the files: - - ```console - $ docker buildx bake -f docker-bake.hcl -f env.hcl --print app - { - "group": { - "default": { - "targets": [ - "app" - ] - } - }, - "target": { - "app": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "v1": "pre-def-myuser" - } - } - } - } - ``` - - ### HCL variables and functions - - Similar to how Terraform provides a way to [define variables](https://www.terraform.io/docs/configuration/variables.html#declaring-an-input-variable), - the HCL file format also supports variable block definitions. These can be used - to define variables with values provided by the current environment, or a - default value when unset. - - A [set of generally useful functions](https://github.com/docker/buildx/blob/master/bake/hclparser/stdlib.go) - provided by [go-cty](https://github.com/zclconf/go-cty/tree/main/cty/function/stdlib) - are available for use in HCL files. In addition, [user defined functions](https://github.com/hashicorp/hcl/tree/main/ext/userfunc) - are also supported. - - #### Using interpolation to tag an image with the git sha - - Bake supports variable blocks which are assigned to matching environment - variables or default values. - - ```hcl - # docker-bake.hcl - variable "TAG" { - default = "latest" - } - - group "default" { - targets = ["webapp"] - } - - target "webapp" { - tags = ["docker.io/username/webapp:${TAG}"] - } - ``` - - alternatively, in json format: - - ```json - { - "variable": { - "TAG": { - "default": "latest" - } - } - "group": { - "default": { - "targets": ["webapp"] - } - }, - "target": { - "webapp": { - "tags": ["docker.io/username/webapp:${TAG}"] - } - } - } - ``` - - ```console - $ docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "tags": [ - "docker.io/username/webapp:latest" - ] - } - } - } - ``` - - ```console - $ TAG=$(git rev-parse --short HEAD) docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "tags": [ - "docker.io/username/webapp:985e9e9" - ] - } - } - } - ``` - - #### Using the `add` function - - You can use [`go-cty` stdlib functions](https://github.com/zclconf/go-cty/tree/main/cty/function/stdlib). - Here we are using the `add` function. - - ```hcl - # docker-bake.hcl - variable "TAG" { - default = "latest" - } - - group "default" { - targets = ["webapp"] - } - - target "webapp" { - args = { - buildno = "${add(123, 1)}" - } - } - ``` - - ```console - $ docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "buildno": "124" - } - } - } - } - ``` - - #### Defining an `increment` function - - It also supports [user defined functions](https://github.com/hashicorp/hcl/tree/main/ext/userfunc). - The following example defines a simple an `increment` function. - - ```hcl - # docker-bake.hcl - function "increment" { - params = [number] - result = number + 1 - } - - group "default" { - targets = ["webapp"] - } - - target "webapp" { - args = { - buildno = "${increment(123)}" - } - } - ``` - - ```console - $ docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "buildno": "124" - } - } - } - } - ``` - - #### Only adding tags if a variable is not empty using an `notequal` - - Here we are using the conditional `notequal` function which is just for - symmetry with the `equal` one. - - ```hcl - # docker-bake.hcl - variable "TAG" {default="" } - - group "default" { - targets = [ - "webapp", - ] - } - - target "webapp" { - context="." - dockerfile="Dockerfile" - tags = [ - "my-image:latest", - notequal("",TAG) ? "my-image:${TAG}": "", - ] - } - ``` - - ```console - $ docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "tags": [ - "my-image:latest" - ] - } - } - } - ``` - - #### Using variables in functions - - You can refer variables to other variables like the target blocks can. Stdlib - functions can also be called but user functions can't at the moment. - - ```hcl - # docker-bake.hcl - variable "REPO" { - default = "user/repo" - } - - function "tag" { - params = [tag] - result = ["${REPO}:${tag}"] - } - - target "webapp" { - tags = tag("v1") - } - ``` - - ```console - $ docker buildx bake --print webapp - { - "group": { - "default": { - "targets": [ - "webapp" - ] - } - }, - "target": { - "webapp": { - "context": ".", - "dockerfile": "Dockerfile", - "tags": [ - "user/repo:v1" - ] - } - } - } - ``` - - #### Using variables in variables across files - - When multiple files are specified, one file can use variables defined in - another file. - - ```hcl - # docker-bake1.hcl - variable "FOO" { - default = upper("${BASE}def") - } - - variable "BAR" { - default = "-${FOO}-" - } - - target "app" { - args = { - v1 = "pre-${BAR}" - } - } - ``` - - ```hcl - # docker-bake2.hcl - variable "BASE" { - default = "abc" - } - - target "app" { - args = { - v2 = "${FOO}-post" - } - } - ``` - - ```console - $ docker buildx bake -f docker-bake1.hcl -f docker-bake2.hcl --print app - { - "group": { - "default": { - "targets": [ - "app" - ] - } - }, - "target": { - "app": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "v1": "pre--ABCDEF-", - "v2": "ABCDEF-post" - } - } - } - } - ``` - - #### Using typed variables - - Non-string variables are also accepted. The value passed with env is parsed - into suitable type first. - - ```hcl - # docker-bake.hcl - variable "FOO" { - default = 3 - } - - variable "IS_FOO" { - default = true - } - - target "app" { - args = { - v1 = FOO > 5 ? "higher" : "lower" - v2 = IS_FOO ? "yes" : "no" - } - } - ``` - - ```console - $ docker buildx bake --print app - { - "group": { - "default": { - "targets": [ - "app" - ] - } - }, - "target": { - "app": { - "context": ".", - "dockerfile": "Dockerfile", - "args": { - "v1": "lower", - "v2": "yes" - } - } - } - } - ``` - - ### Defining additional build contexts and linking targets - - In addition to the main `context` key that defines the build context each target can also define additional named contexts with a map defined with key `contexts`. These values map to the `--build-context` flag in the [build command](buildx_build.md#build-context). - - Inside the Dockerfile these contexts can be used with the `FROM` instruction or `--from` flag. - - The value can be a local source directory, container image (with docker-image:// prefix), Git URL, HTTP URL or a name of another target in the Bake file (with target: prefix). - - #### Pinning alpine image - - ```Dockerfile - # Dockerfile - FROM alpine - RUN echo "Hello world" - ``` - - ```hcl - # docker-bake.hcl - target "app" { - contexts = { - alpine = "docker-image://alpine:3.13" - } - } - ``` - - #### Using a secondary source directory - - ```Dockerfile - # Dockerfile - - FROM scratch AS src - - FROM golang - COPY --from=src . . - ``` - - ```hcl - # docker-bake.hcl - target "app" { - contexts = { - src = "../path/to/source" - } - } - ``` - - #### Using a result of one target as a base image in another target - - To use a result of one target as a build context of another, specity the target name with `target:` prefix. - - ```Dockerfile - # Dockerfile - FROM baseapp - RUN echo "Hello world" - ``` - - ```hcl - # docker-bake.hcl - - target "base" { - dockerfile = "baseapp.Dockerfile" - } - - target "app" { - contexts = { - baseapp = "target:base" - } - } - ``` - - Please note that in most cases you should just use a single multi-stage Dockerfile with multiple targets for similar behavior. This case is recommended when you have multiple Dockerfiles that can't be easily merged into one. - - ### Extension field with Compose - - [Special extension](https://github.com/compose-spec/compose-spec/blob/master/spec.md#extension) - field `x-bake` can be used in your compose file to evaluate fields that are not - (yet) available in the [build definition](https://github.com/compose-spec/compose-spec/blob/master/build.md#build-definition). - - ```yaml - # docker-compose.yml - services: - addon: - image: ct-addon:bar - build: - context: . - dockerfile: ./Dockerfile - args: - CT_ECR: foo - CT_TAG: bar - x-bake: - tags: - - ct-addon:foo - - ct-addon:alp - platforms: - - linux/amd64 - - linux/arm64 - cache-from: - - user/app:cache - - type=local,src=path/to/cache - cache-to: type=local,dest=path/to/cache - pull: true - - aws: - image: ct-fake-aws:bar - build: - dockerfile: ./aws.Dockerfile - args: - CT_ECR: foo - CT_TAG: bar - x-bake: - secret: - - id=mysecret,src=./secret - - id=mysecret2,src=./secret2 - platforms: linux/arm64 - output: type=docker - no-cache: true - ``` - - ```console - $ docker buildx bake --print - { - "group": { - "default": { - "targets": [ - "aws", - "addon" - ] - } - }, - "target": { - "addon": { - "context": ".", - "dockerfile": "./Dockerfile", - "args": { - "CT_ECR": "foo", - "CT_TAG": "bar" - }, - "tags": [ - "ct-addon:foo", - "ct-addon:alp" - ], - "cache-from": [ - "user/app:cache", - "type=local,src=path/to/cache" - ], - "cache-to": [ - "type=local,dest=path/to/cache" - ], - "platforms": [ - "linux/amd64", - "linux/arm64" - ], - "pull": true }, - "aws": { - "context": ".", - "dockerfile": "./aws.Dockerfile", - "args": { - "CT_ECR": "foo", - "CT_TAG": "bar" - }, - "tags": [ - "ct-fake-aws:bar" - ], - "secret": [ - "id=mysecret,src=./secret", - "id=mysecret2,src=./secret2" - ], - "platforms": [ - "linux/arm64" - ], - "output": [ - "type=docker" - ], - "no-cache": true + "target": { + "db": { + "context": "./", + "dockerfile": "Dockerfile", + "tags": [ + "docker.io/tiborvass/db" + ] + } } } - } - ``` + ``` - Complete list of valid fields for `x-bake`: + ### Set type of progress output (--progress) {#progress} - `tags`, `cache-from`, `cache-to`, `secret`, `ssh`, `platforms`, `output`, - `pull`, `no-cache`, `no-cache-filter` + Same as [`build --progress`](buildx_build.md#progress). - ### Built-in variables + ### Always attempt to pull a newer version of the image (--pull) {#pull} - * `BAKE_CMD_CONTEXT` can be used to access the main `context` for bake command - from a bake file that has been [imported remotely](#file). - * `BAKE_LOCAL_PLATFORM` returns the current platform's default platform - specification (e.g. `linux/amd64`). + Same as `build --pull`. + + ### Override target configurations from command line (--set) {#set} + + ``` + --set targetpattern.key[.subkey]=value + ``` + + Override target configurations from command line. The pattern matching syntax + is defined in https://golang.org/pkg/path/#Match. + + ```console + $ docker buildx bake --set target.args.mybuildarg=value + $ docker buildx bake --set target.platform=linux/arm64 + $ docker buildx bake --set foo*.args.mybuildarg=value # overrides build arg for all targets starting with 'foo' + $ docker buildx bake --set *.platform=linux/arm64 # overrides platform for all targets + $ docker buildx bake --set foo*.no-cache # bypass caching only for targets starting with 'foo' + ``` + + Complete list of overridable fields: + + * `args` + * `cache-from` + * `cache-to` + * `context` + * `dockerfile` + * `labels` + * `no-cache` + * `no-cache-filter` + * `output` + * `platform` + * `pull` + * `push` + * `secrets` + * `ssh` + * `tags` + * `target` deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_build.yaml b/_data/buildx/docker_buildx_build.yaml index 381064e5a5..d97e90fb6f 100644 --- a/_data/buildx/docker_buildx_build.yaml +++ b/_data/buildx/docker_buildx_build.yaml @@ -1,904 +1,957 @@ command: docker buildx build -aliases: b +aliases: docker buildx build, docker buildx b short: Start a build long: |- - The `buildx build` command starts a build using BuildKit. This command is similar - to the UI of `docker build` command and takes the same flags and arguments. + The `buildx build` command starts a build using BuildKit. This command is similar + to the UI of `docker build` command and takes the same flags and arguments. - For documentation on most of these flags, refer to the [`docker build` - documentation](/engine/reference/commandline/build/). In - here we'll document a subset of the new flags. + For documentation on most of these flags, refer to the [`docker build` + documentation](/engine/reference/commandline/build/). In + here we'll document a subset of the new flags. usage: docker buildx build [OPTIONS] PATH | URL | - pname: docker buildx plink: docker_buildx.yaml options: -- option: add-host - value_type: stringSlice - default_value: '[]' - description: 'Add a custom host-to-IP mapping (format: `host:ip`)' - details_url: /engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: allow - value_type: stringSlice - default_value: '[]' - description: | - Allow extra privileged entitlement (e.g., `network.host`, `security.insecure`) - details_url: '#allow' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: build-arg - value_type: stringArray - default_value: '[]' - description: Set build-time variables - details_url: '#build-arg' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: build-context - value_type: stringArray - default_value: '[]' - description: Additional build contexts (e.g., name=path) - details_url: '#build-context' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cache-from - value_type: stringArray - default_value: '[]' - description: | - External cache sources (e.g., `user/app:cache`, `type=local,src=path/to/dir`) - details_url: '#cache-from' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cache-to - value_type: stringArray - default_value: '[]' - description: | - Cache export destinations (e.g., `user/app:cache`, `type=local,dest=path/to/dir`) - details_url: '#cache-to' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cgroup-parent - value_type: string - description: Optional parent cgroup for the container - details_url: /engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: compress - value_type: bool - default_value: "false" - description: Compress the build context using gzip - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cpu-period - value_type: int64 - default_value: "0" - description: Limit the CPU CFS (Completely Fair Scheduler) period - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cpu-quota - value_type: int64 - default_value: "0" - description: Limit the CPU CFS (Completely Fair Scheduler) quota - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cpu-shares - shorthand: c - value_type: int64 - default_value: "0" - description: CPU shares (relative weight) - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cpuset-cpus - value_type: string - description: CPUs in which to allow execution (`0-3`, `0,1`) - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: cpuset-mems - value_type: string - description: MEMs in which to allow execution (`0-3`, `0,1`) - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: file - shorthand: f - value_type: string - description: 'Name of the Dockerfile (default: `PATH/Dockerfile`)' - details_url: /engine/reference/commandline/build/#specify-a-dockerfile--f - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: force-rm - value_type: bool - default_value: "false" - description: Always remove intermediate containers - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: iidfile - value_type: string - description: Write the image ID to the file - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: isolation - value_type: string - description: Container isolation technology - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: label - value_type: stringArray - default_value: '[]' - description: Set metadata for an image - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: load - value_type: bool - default_value: "false" - description: Shorthand for `--output=type=docker` - details_url: '#load' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: memory - shorthand: m - value_type: string - description: Memory limit - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: memory-swap - value_type: string - description: | - Swap limit equal to memory plus swap: `-1` to enable unlimited swap - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: metadata-file - value_type: string - description: Write build result metadata to the file - details_url: '#metadata-file' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: network - value_type: string - default_value: default - description: Set the networking mode for the `RUN` instructions during build - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: no-cache - value_type: bool - default_value: "false" - description: Do not use cache when building the image - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: no-cache-filter - value_type: stringArray - default_value: '[]' - description: Do not cache specified stages - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: output - shorthand: o - value_type: stringArray - default_value: '[]' - description: 'Output destination (format: `type=local,dest=path`)' - details_url: '#output' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: platform - value_type: stringArray - default_value: '[]' - description: Set target platform for build - details_url: '#platform' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: progress - value_type: string - default_value: auto - description: | - Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output - details_url: '#progress' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: pull - value_type: bool - default_value: "false" - description: Always attempt to pull all referenced images - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: push - value_type: bool - default_value: "false" - description: Shorthand for `--output=type=registry` - details_url: '#push' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: quiet - shorthand: q - value_type: bool - default_value: "false" - description: Suppress the build output and print image ID on success - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: rm - value_type: bool - default_value: "true" - description: Remove intermediate containers after a successful build - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: secret - value_type: stringArray - default_value: '[]' - description: | - Secret to expose to the build (format: `id=mysecret[,src=/local/secret]`) - details_url: '#secret' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: security-opt - value_type: stringSlice - default_value: '[]' - description: Security options - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: shm-size - value_type: bytes - default_value: "0" - description: Size of `/dev/shm` - details_url: '#shm-size' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: squash - value_type: bool - default_value: "false" - description: Squash newly built layers into a single new layer - deprecated: false - hidden: true - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: ssh - value_type: stringArray - default_value: '[]' - description: | - SSH agent socket or keys to expose to the build (format: `default|[=|[,]]`) - details_url: '#ssh' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: tag - shorthand: t - value_type: stringArray - default_value: '[]' - description: 'Name and optionally a tag (format: `name:tag`)' - details_url: /engine/reference/commandline/build/#tag-an-image--t - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: target - value_type: string - description: Set the target build stage to build - details_url: /engine/reference/commandline/build/#specifying-target-build-stage---target - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: ulimit - value_type: ulimit - default_value: '[]' - description: Ulimit options - details_url: '#ulimit' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: add-host + value_type: stringSlice + default_value: '[]' + description: 'Add a custom host-to-IP mapping (format: `host:ip`)' + details_url: /engine/reference/commandline/build/#add-entries-to-container-hosts-file---add-host + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: allow + value_type: stringSlice + default_value: '[]' + description: | + Allow extra privileged entitlement (e.g., `network.host`, `security.insecure`) + details_url: '#allow' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: build-arg + value_type: stringArray + default_value: '[]' + description: Set build-time variables + details_url: '#build-arg' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: build-context + value_type: stringArray + default_value: '[]' + description: Additional build contexts (e.g., name=path) + details_url: '#build-context' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cache-from + value_type: stringArray + default_value: '[]' + description: | + External cache sources (e.g., `user/app:cache`, `type=local,src=path/to/dir`) + details_url: '#cache-from' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cache-to + value_type: stringArray + default_value: '[]' + description: | + Cache export destinations (e.g., `user/app:cache`, `type=local,dest=path/to/dir`) + details_url: '#cache-to' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cgroup-parent + value_type: string + description: Optional parent cgroup for the container + details_url: /engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: compress + value_type: bool + default_value: "false" + description: Compress the build context using gzip + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cpu-period + value_type: int64 + default_value: "0" + description: Limit the CPU CFS (Completely Fair Scheduler) period + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cpu-quota + value_type: int64 + default_value: "0" + description: Limit the CPU CFS (Completely Fair Scheduler) quota + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cpu-shares + shorthand: c + value_type: int64 + default_value: "0" + description: CPU shares (relative weight) + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cpuset-cpus + value_type: string + description: CPUs in which to allow execution (`0-3`, `0,1`) + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: cpuset-mems + value_type: string + description: MEMs in which to allow execution (`0-3`, `0,1`) + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: file + shorthand: f + value_type: string + description: 'Name of the Dockerfile (default: `PATH/Dockerfile`)' + details_url: /engine/reference/commandline/build/#specify-a-dockerfile--f + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: force-rm + value_type: bool + default_value: "false" + description: Always remove intermediate containers + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: iidfile + value_type: string + description: Write the image ID to the file + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: invoke + value_type: string + description: Invoke a command after the build [experimental] + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: isolation + value_type: string + description: Container isolation technology + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: label + value_type: stringArray + default_value: '[]' + description: Set metadata for an image + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: load + value_type: bool + default_value: "false" + description: Shorthand for `--output=type=docker` + details_url: '#load' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: memory + shorthand: m + value_type: string + description: Memory limit + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: memory-swap + value_type: string + description: | + Swap limit equal to memory plus swap: `-1` to enable unlimited swap + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: metadata-file + value_type: string + description: Write build result metadata to the file + details_url: '#metadata-file' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: network + value_type: string + default_value: default + description: Set the networking mode for the `RUN` instructions during build + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: no-cache + value_type: bool + default_value: "false" + description: Do not use cache when building the image + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: no-cache-filter + value_type: stringArray + default_value: '[]' + description: Do not cache specified stages + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: output + shorthand: o + value_type: stringArray + default_value: '[]' + description: 'Output destination (format: `type=local,dest=path`)' + details_url: '#output' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: platform + value_type: stringArray + default_value: '[]' + description: Set target platform for build + details_url: '#platform' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: print + value_type: string + description: | + Print result of information request (e.g., outline, targets) [experimental] + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: progress + value_type: string + default_value: auto + description: | + Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output + details_url: '#progress' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: pull + value_type: bool + default_value: "false" + description: Always attempt to pull all referenced images + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: push + value_type: bool + default_value: "false" + description: Shorthand for `--output=type=registry` + details_url: '#push' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: quiet + shorthand: q + value_type: bool + default_value: "false" + description: Suppress the build output and print image ID on success + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: rm + value_type: bool + default_value: "true" + description: Remove intermediate containers after a successful build + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: secret + value_type: stringArray + default_value: '[]' + description: | + Secret to expose to the build (format: `id=mysecret[,src=/local/secret]`) + details_url: '#secret' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: security-opt + value_type: stringSlice + default_value: '[]' + description: Security options + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: shm-size + value_type: bytes + default_value: "0" + description: Size of `/dev/shm` + details_url: '#shm-size' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: squash + value_type: bool + default_value: "false" + description: Squash newly built layers into a single new layer + deprecated: false + hidden: true + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: ssh + value_type: stringArray + default_value: '[]' + description: | + SSH agent socket or keys to expose to the build (format: `default|[=|[,]]`) + details_url: '#ssh' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: tag + shorthand: t + value_type: stringArray + default_value: '[]' + description: 'Name and optionally a tag (format: `name:tag`)' + details_url: /engine/reference/commandline/build/#tag-an-image--t + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: target + value_type: string + description: Set the target build stage to build + details_url: /engine/reference/commandline/build/#specifying-target-build-stage---target + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: ulimit + value_type: ulimit + default_value: '[]' + description: Ulimit options + details_url: '#ulimit' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Allow extra privileged entitlement (--allow) {#allow} + ### Allow extra privileged entitlement (--allow) {#allow} - ``` - --allow=ENTITLEMENT - ``` + ``` + --allow=ENTITLEMENT + ``` - Allow extra privileged entitlement. List of entitlements: + Allow extra privileged entitlement. List of entitlements: - - `network.host` - Allows executions with host networking. - - `security.insecure` - Allows executions without sandbox. See - [related Dockerfile extensions](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md#run---securityinsecuresandbox). + - `network.host` - Allows executions with host networking. + - `security.insecure` - Allows executions without sandbox. See + [related Dockerfile extensions](/engine/reference/builder/#run---securitysandbox). - For entitlements to be enabled, the `buildkitd` daemon also needs to allow them - with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)) + For entitlements to be enabled, the `buildkitd` daemon also needs to allow them + with `--allow-insecure-entitlement` (see [`create --buildkitd-flags`](buildx_create.md#buildkitd-flags)) - **Examples** + **Examples** - ```console - $ docker buildx create --use --name insecure-builder --buildkitd-flags '--allow-insecure-entitlement security.insecure' - $ docker buildx build --allow security.insecure . - ``` + ```console + $ docker buildx create --use --name insecure-builder --buildkitd-flags '--allow-insecure-entitlement security.insecure' + $ docker buildx build --allow security.insecure . + ``` - ### Set build-time variables (--build-arg) {#build-arg} + ### Set build-time variables (--build-arg) {#build-arg} - Same as [`docker build` command](/engine/reference/commandline/build/#set-build-time-variables---build-arg). + Same as [`docker build` command](/engine/reference/commandline/build/#set-build-time-variables---build-arg). - There are also useful built-in build args like: + There are also useful built-in build args like: - * `BUILDKIT_CONTEXT_KEEP_GIT_DIR=` trigger git context to keep the `.git` directory - * `BUILDKIT_INLINE_BUILDINFO_ATTRS=` inline build info attributes in image config or not - * `BUILDKIT_INLINE_CACHE=` inline cache metadata to image config or not - * `BUILDKIT_MULTI_PLATFORM=` opt into determnistic output regardless of multi-platform output or not + * `BUILDKIT_CONTEXT_KEEP_GIT_DIR=` trigger git context to keep the `.git` directory + * `BUILDKIT_INLINE_BUILDINFO_ATTRS=` inline build info attributes in image config or not + * `BUILDKIT_INLINE_CACHE=` inline cache metadata to image config or not + * `BUILDKIT_MULTI_PLATFORM=` opt into deterministic output regardless of multi-platform output or not - ```console - $ docker buildx build --build-arg BUILDKIT_MULTI_PLATFORM=1 . - ``` + ```console + $ docker buildx build --build-arg BUILDKIT_MULTI_PLATFORM=1 . + ``` - More built-in build args can be found in [dockerfile frontend docs](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#built-in-build-args). + > **Note** + > + > More built-in build args can be found in [Dockerfile reference docs](/engine/reference/builder/#buildkit-built-in-build-args). - ### Additional build contexts (--build-context) {#build-context} + ### Additional build contexts (--build-context) {#build-context} - ``` - --build-context=name=VALUE - ``` + ``` + --build-context=name=VALUE + ``` - Define additional build context with specified contents. In Dockerfile the context can be accessed when `FROM name` or `--from=name` is used. - When Dockerfile defines a stage with the same name it is overwritten. + Define additional build context with specified contents. In Dockerfile the context can be accessed when `FROM name` or `--from=name` is used. + When Dockerfile defines a stage with the same name it is overwritten. - The value can be a local source directory, container image (with docker-image:// prefix), Git or HTTP URL. + The value can be a local source directory, [local OCI layout compliant directory](https://github.com/opencontainers/image-spec/blob/main/image-layout.md), container image (with docker-image:// prefix), Git or HTTP URL. - Replace `alpine:latest` with a pinned one: + Replace `alpine:latest` with a pinned one: - ```console - $ docker buildx build --build-context alpine=docker-image://alpine@sha256:0123456789 . - ``` + ```console + $ docker buildx build --build-context alpine=docker-image://alpine@sha256:0123456789 . + ``` - Expose a secondary local source directory: + Expose a secondary local source directory: - ```console - $ docker buildx build --build-context project=path/to/project/source . - # docker buildx build --build-context project=https://github.com/myuser/project.git . - ``` + ```console + $ docker buildx build --build-context project=path/to/project/source . + # docker buildx build --build-context project=https://github.com/myuser/project.git . + ``` - ```Dockerfile - FROM alpine - COPY --from=project myfile / - ``` + ```Dockerfile + FROM alpine + COPY --from=project myfile / + ``` - ### Override the configured builder instance (--builder) {#builder} + #### Source image from OCI layout directory {#source-oci-layout} - Same as [`buildx --builder`](buildx.md#builder). + Source an image from a local [OCI layout compliant directory](https://github.com/opencontainers/image-spec/blob/main/image-layout.md): - ### Use an external cache source for a build (--cache-from) {#cache-from} + ```console + $ docker buildx build --build-context foo=oci-layout:///path/to/local/layout@sha256:abcd12345 . + ``` - ``` - --cache-from=[NAME|type=TYPE[,KEY=VALUE]] - ``` + ```Dockerfile + FROM alpine + RUN apk add git - Use an external cache source for a build. Supported types are `registry`, - `local` and `gha`. + COPY --from=foo myfile / - - [`registry` source](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) - can import cache from a cache manifest or (special) image configuration on the - registry. - - [`local` source](https://github.com/moby/buildkit#local-directory-1) can - import cache from local files previously exported with `--cache-to`. - - [`gha` source](https://github.com/moby/buildkit#github-actions-cache-experimental) - can import cache from a previously exported cache with `--cache-to` in your - GitHub repository + FROM foo + ``` - If no type is specified, `registry` exporter is used with a specified reference. + The OCI layout directory must be compliant with the [OCI layout specification](https://github.com/opencontainers/image-spec/blob/main/image-layout.md). It looks _solely_ for hashes. It does not + do any form of `image:tag` resolution to find the hash of the manifest; that is up to you. - `docker` driver currently only supports importing build cache from the registry. + The format of the `--build-context` must be: `=oci-layout://@sha256:`, where: - ```console - $ docker buildx build --cache-from=user/app:cache . - $ docker buildx build --cache-from=user/app . - $ docker buildx build --cache-from=type=registry,ref=user/app . - $ docker buildx build --cache-from=type=local,src=path/to/cache . - $ docker buildx build --cache-from=type=gha . - ``` + * `context` is the name of the build context as used in the `Dockerfile`. + * `path-to-local-layout` is the path on the local machine, where you are running `docker build`, to the spec-compliant OCI layout. + * `hash-of-manifest` is the hash of the manifest for the image. It can be a single-architecture manifest or a multi-architecture index. - More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache + ### Override the configured builder instance (--builder) {#builder} - ### Export build cache to an external cache destination (--cache-to) {#cache-to} + Same as [`buildx --builder`](buildx.md#builder). - ``` - --cache-to=[NAME|type=TYPE[,KEY=VALUE]] - ``` + ### Use an external cache source for a build (--cache-from) {#cache-from} - Export build cache to an external cache destination. Supported types are - `registry`, `local`, `inline` and `gha`. + ``` + --cache-from=[NAME|type=TYPE[,KEY=VALUE]] + ``` - - [`registry` type](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) exports build cache to a cache manifest in the registry. - - [`local` type](https://github.com/moby/buildkit#local-directory-1) type - exports cache to a local directory on the client. - - [`inline` type](https://github.com/moby/buildkit#inline-push-image-and-cache-together) - type writes the cache metadata into the image configuration. - - [`gha` type](https://github.com/moby/buildkit#github-actions-cache-experimental) - type exports cache through the [Github Actions Cache service API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication). + Use an external cache source for a build. Supported types are `registry`, + `local` and `gha`. - `docker` driver currently only supports exporting inline cache metadata to image - configuration. Alternatively, `--build-arg BUILDKIT_INLINE_CACHE=1` can be used - to trigger inline cache exporter. + - [`registry` source](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) + can import cache from a cache manifest or (special) image configuration on the + registry. + - [`local` source](https://github.com/moby/buildkit#local-directory-1) can + import cache from local files previously exported with `--cache-to`. + - [`gha` source](https://github.com/moby/buildkit#github-actions-cache-experimental) + can import cache from a previously exported cache with `--cache-to` in your + GitHub repository - Attribute key: + If no type is specified, `registry` exporter is used with a specified reference. - - `mode` - Specifies how many layers are exported with the cache. `min` on only - exports layers already in the final build stage, `max` exports layers for - all stages. Metadata is always exported for the whole build. + `docker` driver currently only supports importing build cache from the registry. - ```console - $ docker buildx build --cache-to=user/app:cache . - $ docker buildx build --cache-to=type=inline . - $ docker buildx build --cache-to=type=registry,ref=user/app . - $ docker buildx build --cache-to=type=local,dest=path/to/cache . - $ docker buildx build --cache-to=type=gha . - ``` + ```console + $ docker buildx build --cache-from=user/app:cache . + $ docker buildx build --cache-from=user/app . + $ docker buildx build --cache-from=type=registry,ref=user/app . + $ docker buildx build --cache-from=type=local,src=path/to/cache . + $ docker buildx build --cache-from=type=gha . + ``` - More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache + More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache - ### Load the single-platform build result to `docker images` (--load) {#load} + ### Export build cache to an external cache destination (--cache-to) {#cache-to} - Shorthand for [`--output=type=docker`](#docker). Will automatically load the - single-platform build result to `docker images`. + ``` + --cache-to=[NAME|type=TYPE[,KEY=VALUE]] + ``` - ### Write build result metadata to the file (--metadata-file) {#metadata-file} + Export build cache to an external cache destination. Supported types are + `registry`, `local`, `inline` and `gha`. - To output build metadata such as the image digest, pass the `--metadata-file` flag. - The metadata will be written as a JSON object to the specified file. The - directory of the specified file must already exist and be writable. + - [`registry` type](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) exports build cache to a cache manifest in the registry. + - [`local` type](https://github.com/moby/buildkit#local-directory-1) type + exports cache to a local directory on the client. + - [`inline` type](https://github.com/moby/buildkit#inline-push-image-and-cache-together) + type writes the cache metadata into the image configuration. + - [`gha` type](https://github.com/moby/buildkit#github-actions-cache-experimental) + type exports cache through the [Github Actions Cache service API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication). - ```console - $ docker buildx build --load --metadata-file metadata.json . - $ cat metadata.json - ``` - ```json - { - "containerimage.buildinfo": { - "frontend": "dockerfile.v0", - "attrs": { - "context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master", - "filename": "Dockerfile", - "source": "docker/dockerfile:master" - }, - "sources": [ - { - "type": "docker-image", - "ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0", - "pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0" + `docker` driver currently only supports exporting inline cache metadata to image + configuration. Alternatively, `--build-arg BUILDKIT_INLINE_CACHE=1` can be used + to trigger inline cache exporter. + + Attribute key: + + - `mode` - Specifies how many layers are exported with the cache. `min` on only + exports layers already in the final build stage, `max` exports layers for + all stages. Metadata is always exported for the whole build. + + ```console + $ docker buildx build --cache-to=user/app:cache . + $ docker buildx build --cache-to=type=inline . + $ docker buildx build --cache-to=type=registry,ref=user/app . + $ docker buildx build --cache-to=type=local,dest=path/to/cache . + $ docker buildx build --cache-to=type=gha . + ``` + + More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache + + ### Load the single-platform build result to `docker images` (--load) {#load} + + Shorthand for [`--output=type=docker`](#docker). Will automatically load the + single-platform build result to `docker images`. + + ### Write build result metadata to the file (--metadata-file) {#metadata-file} + + To output build metadata such as the image digest, pass the `--metadata-file` flag. + The metadata will be written as a JSON object to the specified file. The + directory of the specified file must already exist and be writable. + + ```console + $ docker buildx build --load --metadata-file metadata.json . + $ cat metadata.json + ``` + ```json + { + "containerimage.buildinfo": { + "frontend": "dockerfile.v0", + "attrs": { + "context": "https://github.com/crazy-max/buildkit-buildsources-test.git#master", + "filename": "Dockerfile", + "source": "docker/dockerfile:master" }, - { - "type": "docker-image", - "ref": "docker.io/library/alpine:3.13", - "pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c" - } - ] - }, - "containerimage.config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66", - "containerimage.descriptor": { - "annotations": { - "config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66", - "org.opencontainers.image.created": "2022-02-08T21:28:03Z" + "sources": [ + { + "type": "docker-image", + "ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0", + "pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0" + }, + { + "type": "docker-image", + "ref": "docker.io/library/alpine:3.13", + "pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c" + } + ] }, - "digest": "sha256:19ffeab6f8bc9293ac2c3fdf94ebe28396254c993aea0b5a542cfb02e0883fa3", - "mediaType": "application/vnd.oci.image.manifest.v1+json", - "size": 506 - }, - "containerimage.digest": "sha256:19ffeab6f8bc9293ac2c3fdf94ebe28396254c993aea0b5a542cfb02e0883fa3" - } - ``` + "containerimage.config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66", + "containerimage.descriptor": { + "annotations": { + "config.digest": "sha256:2937f66a9722f7f4a2df583de2f8cb97fc9196059a410e7f00072fc918930e66", + "org.opencontainers.image.created": "2022-02-08T21:28:03Z" + }, + "digest": "sha256:19ffeab6f8bc9293ac2c3fdf94ebe28396254c993aea0b5a542cfb02e0883fa3", + "mediaType": "application/vnd.oci.image.manifest.v1+json", + "size": 506 + }, + "containerimage.digest": "sha256:19ffeab6f8bc9293ac2c3fdf94ebe28396254c993aea0b5a542cfb02e0883fa3" + } + ``` - ### Set the export action for the build result (-o, --output) {#output} + ### Set the export action for the build result (-o, --output) {#output} - ``` - -o, --output=[PATH,-,type=TYPE[,KEY=VALUE] - ``` + ``` + -o, --output=[PATH,-,type=TYPE[,KEY=VALUE] + ``` - Sets the export action for the build result. In `docker build` all builds finish - by creating a container image and exporting it to `docker images`. `buildx` makes - this step configurable allowing results to be exported directly to the client, - oci image tarballs, registry etc. + Sets the export action for the build result. In `docker build` all builds finish + by creating a container image and exporting it to `docker images`. `buildx` makes + this step configurable allowing results to be exported directly to the client, + oci image tarballs, registry etc. - Buildx with `docker` driver currently only supports local, tarball exporter and - image exporter. `docker-container` driver supports all the exporters. + Buildx with `docker` driver currently only supports local, tarball exporter and + image exporter. `docker-container` driver supports all the exporters. - If just the path is specified as a value, `buildx` will use the local exporter - with this path as the destination. If the value is "-", `buildx` will use `tar` - exporter and write to `stdout`. + If just the path is specified as a value, `buildx` will use the local exporter + with this path as the destination. If the value is "-", `buildx` will use `tar` + exporter and write to `stdout`. - ```console - $ docker buildx build -o . . - $ docker buildx build -o outdir . - $ docker buildx build -o - - > out.tar - $ docker buildx build -o type=docker . - $ docker buildx build -o type=docker,dest=- . > myimage.tar - $ docker buildx build -t tonistiigi/foo -o type=registry - ``` + ```console + $ docker buildx build -o . . + $ docker buildx build -o outdir . + $ docker buildx build -o - - > out.tar + $ docker buildx build -o type=docker . + $ docker buildx build -o type=docker,dest=- . > myimage.tar + $ docker buildx build -t tonistiigi/foo -o type=registry + ``` - Supported exported types are: + Supported exported types are: - #### `local` + #### `local` - The `local` export type writes all result files to a directory on the client. The - new files will be owned by the current user. On multi-platform builds, all results - will be put in subdirectories by their platform. + The `local` export type writes all result files to a directory on the client. The + new files will be owned by the current user. On multi-platform builds, all results + will be put in subdirectories by their platform. - Attribute key: + Attribute key: - - `dest` - destination directory where files will be written + - `dest` - destination directory where files will be written - #### `tar` + #### `tar` - The `tar` export type writes all result files as a single tarball on the client. - On multi-platform builds all results will be put in subdirectories by their platform. + The `tar` export type writes all result files as a single tarball on the client. + On multi-platform builds all results will be put in subdirectories by their platform. - Attribute key: + Attribute key: - - `dest` - destination path where tarball will be written. “-” writes to stdout. + - `dest` - destination path where tarball will be written. “-” writes to stdout. - #### `oci` + #### `oci` - The `oci` export type writes the result image or manifest list as an [OCI image - layout](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-layout.md) - tarball on the client. + The `oci` export type writes the result image or manifest list as an [OCI image + layout](https://github.com/opencontainers/image-spec/blob/v1.0.1/image-layout.md) + tarball on the client. - Attribute key: + Attribute key: - - `dest` - destination path where tarball will be written. “-” writes to stdout. + - `dest` - destination path where tarball will be written. “-” writes to stdout. - #### `docker` + #### `docker` - The `docker` export type writes the single-platform result image as a [Docker image - specification](https://github.com/docker/docker/blob/v20.10.2/image/spec/v1.2.md) - tarball on the client. Tarballs created by this exporter are also OCI compatible. + The `docker` export type writes the single-platform result image as a [Docker image + specification](https://github.com/docker/docker/blob/v20.10.2/image/spec/v1.2.md) + tarball on the client. Tarballs created by this exporter are also OCI compatible. - Currently, multi-platform images cannot be exported with the `docker` export type. - The most common usecase for multi-platform images is to directly push to a registry - (see [`registry`](#registry)). + Currently, multi-platform images cannot be exported with the `docker` export type. + The most common usecase for multi-platform images is to directly push to a registry + (see [`registry`](#registry)). - Attribute keys: + Attribute keys: - - `dest` - destination path where tarball will be written. If not specified the - tar will be loaded automatically to the current docker instance. - - `context` - name for the docker context where to import the result + - `dest` - destination path where tarball will be written. If not specified the + tar will be loaded automatically to the current docker instance. + - `context` - name for the docker context where to import the result - #### `image` + #### `image` - The `image` exporter writes the build result as an image or a manifest list. When - using `docker` driver the image will appear in `docker images`. Optionally, image - can be automatically pushed to a registry by specifying attributes. + The `image` exporter writes the build result as an image or a manifest list. When + using `docker` driver the image will appear in `docker images`. Optionally, image + can be automatically pushed to a registry by specifying attributes. - Attribute keys: + Attribute keys: - - `name` - name (references) for the new image. - - `push` - boolean to automatically push the image. + - `name` - name (references) for the new image. + - `push` - boolean to automatically push the image. - #### `registry` + #### `registry` - The `registry` exporter is a shortcut for `type=image,push=true`. + The `registry` exporter is a shortcut for `type=image,push=true`. - ### Set the target platforms for the build (--platform) {#platform} + ### Set the target platforms for the build (--platform) {#platform} - ``` - --platform=value[,value] - ``` + ``` + --platform=value[,value] + ``` - Set the target platform for the build. All `FROM` commands inside the Dockerfile - without their own `--platform` flag will pull base images for this platform and - this value will also be the platform of the resulting image. The default value - will be the current platform of the buildkit daemon. + Set the target platform for the build. All `FROM` commands inside the Dockerfile + without their own `--platform` flag will pull base images for this platform and + this value will also be the platform of the resulting image. The default value + will be the current platform of the buildkit daemon. - When using `docker-container` driver with `buildx`, this flag can accept multiple - values as an input separated by a comma. With multiple values the result will be - built for all of the specified platforms and joined together into a single manifest - list. + When using `docker-container` driver with `buildx`, this flag can accept multiple + values as an input separated by a comma. With multiple values the result will be + built for all of the specified platforms and joined together into a single manifest + list. - If the `Dockerfile` needs to invoke the `RUN` command, the builder needs runtime - support for the specified platform. In a clean setup, you can only execute `RUN` - commands for your system architecture. - If your kernel supports [`binfmt_misc`](https://en.wikipedia.org/wiki/Binfmt_misc) - launchers for secondary architectures, buildx will pick them up automatically. - Docker desktop releases come with `binfmt_misc` automatically configured for `arm64` - and `arm` architectures. You can see what runtime platforms your current builder - instance supports by running `docker buildx inspect --bootstrap`. + If the `Dockerfile` needs to invoke the `RUN` command, the builder needs runtime + support for the specified platform. In a clean setup, you can only execute `RUN` + commands for your system architecture. + If your kernel supports [`binfmt_misc`](https://en.wikipedia.org/wiki/Binfmt_misc) + launchers for secondary architectures, buildx will pick them up automatically. + Docker desktop releases come with `binfmt_misc` automatically configured for `arm64` + and `arm` architectures. You can see what runtime platforms your current builder + instance supports by running `docker buildx inspect --bootstrap`. - Inside a `Dockerfile`, you can access the current platform value through - `TARGETPLATFORM` build argument. Please refer to the [`docker build` - documentation](/engine/reference/builder/#automatic-platform-args-in-the-global-scope) - for the full description of automatic platform argument variants . + Inside a `Dockerfile`, you can access the current platform value through + `TARGETPLATFORM` build argument. Please refer to the [`docker build` + documentation](/engine/reference/builder/#automatic-platform-args-in-the-global-scope) + for the full description of automatic platform argument variants . - The formatting for the platform specifier is defined in the [containerd source - code](https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L63). + The formatting for the platform specifier is defined in the [containerd source + code](https://github.com/containerd/containerd/blob/v1.4.3/platforms/platforms.go#L63). - ```console - $ docker buildx build --platform=linux/arm64 . - $ docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 . - $ docker buildx build --platform=darwin . - ``` + ```console + $ docker buildx build --platform=linux/arm64 . + $ docker buildx build --platform=linux/amd64,linux/arm64,linux/arm/v7 . + $ docker buildx build --platform=darwin . + ``` - ### Set type of progress output (--progress) {#progress} + ### Set type of progress output (--progress) {#progress} - ``` - --progress=VALUE - ``` + ``` + --progress=VALUE + ``` - Set type of progress output (auto, plain, tty). Use plain to show container - output (default "auto"). + Set type of progress output (auto, plain, tty). Use plain to show container + output (default "auto"). - > You can also use the `BUILDKIT_PROGRESS` environment variable to set - > its value. + > **Note** + > + > You can also use the `BUILDKIT_PROGRESS` environment variable to set its value. - The following example uses `plain` output during the build: + The following example uses `plain` output during the build: - ```console - $ docker buildx build --load --progress=plain . + ```console + $ docker buildx build --load --progress=plain . - #1 [internal] load build definition from Dockerfile - #1 transferring dockerfile: 227B 0.0s done - #1 DONE 0.1s + #1 [internal] load build definition from Dockerfile + #1 transferring dockerfile: 227B 0.0s done + #1 DONE 0.1s - #2 [internal] load .dockerignore - #2 transferring context: 129B 0.0s done - #2 DONE 0.0s - ... - ``` + #2 [internal] load .dockerignore + #2 transferring context: 129B 0.0s done + #2 DONE 0.0s + ... + ``` - ### Push the build result to a registry (--push) {#push} + > **Note** + > + > Check also our [Color output controls guide](https://github.com/docker/buildx/blob/master/docs/guides/color-output.md) + > for modifying the colors that are used to output information to the terminal. - Shorthand for [`--output=type=registry`](#registry). Will automatically push the - build result to registry. + ### Push the build result to a registry (--push) {#push} - ### Secret to expose to the build (--secret) {#secret} + Shorthand for [`--output=type=registry`](#registry). Will automatically push the + build result to registry. - ``` - --secret=[type=TYPE[,KEY=VALUE] - ``` + ### Secret to expose to the build (--secret) {#secret} - Exposes secret to the build. The secret can be used by the build using - [`RUN --mount=type=secret` mount](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#run---mounttypesecret). + ``` + --secret=[type=TYPE[,KEY=VALUE] + ``` - If `type` is unset it will be detected. Supported types are: + Exposes secret to the build. The secret can be used by the build using + [`RUN --mount=type=secret` mount](/engine/reference/builder/#run---mounttypesecret). - #### `file` + If `type` is unset it will be detected. Supported types are: - Attribute keys: + #### `file` - - `id` - ID of the secret. Defaults to basename of the `src` path. - - `src`, `source` - Secret filename. `id` used if unset. + Attribute keys: - ```dockerfile - # syntax=docker/dockerfile:1.3 - FROM python:3 - RUN pip install awscli - RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \ - aws s3 cp s3://... ... - ``` + - `id` - ID of the secret. Defaults to basename of the `src` path. + - `src`, `source` - Secret filename. `id` used if unset. - ```console - $ docker buildx build --secret id=aws,src=$HOME/.aws/credentials . - ``` + ```dockerfile + # syntax=docker/dockerfile:1.4 + FROM python:3 + RUN pip install awscli + RUN --mount=type=secret,id=aws,target=/root/.aws/credentials \ + aws s3 cp s3://... ... + ``` - #### `env` + ```console + $ docker buildx build --secret id=aws,src=$HOME/.aws/credentials . + ``` - Attribute keys: + #### `env` - - `id` - ID of the secret. Defaults to `env` name. - - `env` - Secret environment variable. `id` used if unset, otherwise will look for `src`, `source` if `id` unset. + Attribute keys: - ```dockerfile - # syntax=docker/dockerfile:1.3 - FROM node:alpine - RUN --mount=type=bind,target=. \ - --mount=type=secret,id=SECRET_TOKEN \ - SECRET_TOKEN=$(cat /run/secrets/SECRET_TOKEN) yarn run test - ``` + - `id` - ID of the secret. Defaults to `env` name. + - `env` - Secret environment variable. `id` used if unset, otherwise will look for `src`, `source` if `id` unset. - ```console - $ SECRET_TOKEN=token docker buildx build --secret id=SECRET_TOKEN . - ``` + ```dockerfile + # syntax=docker/dockerfile:1.4 + FROM node:alpine + RUN --mount=type=bind,target=. \ + --mount=type=secret,id=SECRET_TOKEN \ + SECRET_TOKEN=$(cat /run/secrets/SECRET_TOKEN) yarn run test + ``` - ### Size of /dev/shm (--shm-size) {#shm-size} + ```console + $ SECRET_TOKEN=token docker buildx build --secret id=SECRET_TOKEN . + ``` - The format is ``. `number` must be greater than `0`. Unit is - optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` - (gigabytes). If you omit the unit, the system uses bytes. + ### Size of /dev/shm (--shm-size) {#shm-size} - ### SSH agent socket or keys to expose to the build (--ssh) {#ssh} + The format is ``. `number` must be greater than `0`. Unit is + optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes), or `g` + (gigabytes). If you omit the unit, the system uses bytes. - ``` - --ssh=default|[=|[,]] - ``` + ### SSH agent socket or keys to expose to the build (--ssh) {#ssh} - This can be useful when some commands in your Dockerfile need specific SSH - authentication (e.g., cloning a private repository). + ``` + --ssh=default|[=|[,]] + ``` - `--ssh` exposes SSH agent socket or keys to the build and can be used with the - [`RUN --mount=type=ssh` mount](https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#run---mounttypessh). + This can be useful when some commands in your Dockerfile need specific SSH + authentication (e.g., cloning a private repository). - Example to access Gitlab using an SSH agent socket: + `--ssh` exposes SSH agent socket or keys to the build and can be used with the + [`RUN --mount=type=ssh` mount](/engine/reference/builder/#run---mounttypessh). - ```dockerfile - # syntax=docker/dockerfile:1.3 - FROM alpine - RUN apk add --no-cache openssh-client - RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts - RUN --mount=type=ssh ssh -q -T git@gitlab.com 2>&1 | tee /hello - # "Welcome to GitLab, @GITLAB_USERNAME_ASSOCIATED_WITH_SSHKEY" should be printed here - # with the type of build progress is defined as `plain`. - ``` + Example to access Gitlab using an SSH agent socket: - ```console - $ eval $(ssh-agent) - $ ssh-add ~/.ssh/id_rsa - (Input your passphrase here) - $ docker buildx build --ssh default=$SSH_AUTH_SOCK . - ``` + ```dockerfile + # syntax=docker/dockerfile:1.4 + FROM alpine + RUN apk add --no-cache openssh-client + RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com >> ~/.ssh/known_hosts + RUN --mount=type=ssh ssh -q -T git@gitlab.com 2>&1 | tee /hello + # "Welcome to GitLab, @GITLAB_USERNAME_ASSOCIATED_WITH_SSHKEY" should be printed here + # with the type of build progress is defined as `plain`. + ``` - ### Set ulimits (--ulimit) {#ulimit} + ```console + $ eval $(ssh-agent) + $ ssh-add ~/.ssh/id_rsa + (Input your passphrase here) + $ docker buildx build --ssh default=$SSH_AUTH_SOCK . + ``` - `--ulimit` is specified with a soft and hard limit as such: - `=[:]`, for example: + ### Set ulimits (--ulimit) {#ulimit} - ```console - $ docker buildx build --ulimit nofile=1024:1024 . - ``` + `--ulimit` is specified with a soft and hard limit as such: + `=[:]`, for example: - > **Note** - > - > If you do not provide a `hard limit`, the `soft limit` is used - > for both values. If no `ulimits` are set, they are inherited from - > the default `ulimits` set on the daemon. + ```console + $ docker buildx build --ulimit nofile=1024:1024 . + ``` + + > **Note** + > + > If you do not provide a `hard limit`, the `soft limit` is used + > for both values. If no `ulimits` are set, they are inherited from + > the default `ulimits` set on the daemon. deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_create.yaml b/_data/buildx/docker_buildx_create.yaml index 1e763c0129..d4b5392a29 100644 --- a/_data/buildx/docker_buildx_create.yaml +++ b/_data/buildx/docker_buildx_create.yaml @@ -1,237 +1,261 @@ command: docker buildx create short: Create a new builder instance long: |- - Create makes a new builder instance pointing to a docker context or endpoint, - where context is the name of a context from `docker context ls` and endpoint is - the address for docker socket (eg. `DOCKER_HOST` value). + Create makes a new builder instance pointing to a docker context or endpoint, + where context is the name of a context from `docker context ls` and endpoint is + the address for docker socket (eg. `DOCKER_HOST` value). - By default, the current Docker configuration is used for determining the - context/endpoint value. + By default, the current Docker configuration is used for determining the + context/endpoint value. - Builder instances are isolated environments where builds can be invoked. All - Docker contexts also get the default builder instance. + Builder instances are isolated environments where builds can be invoked. All + Docker contexts also get the default builder instance. usage: docker buildx create [OPTIONS] [CONTEXT|ENDPOINT] pname: docker buildx plink: docker_buildx.yaml options: -- option: append - value_type: bool - default_value: "false" - description: Append a node to builder instead of changing it - details_url: '#append' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: bootstrap - value_type: bool - default_value: "false" - description: Boot builder after creation - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: buildkitd-flags - value_type: string - description: Flags for buildkitd daemon - details_url: '#buildkitd-flags' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: config - value_type: string - description: BuildKit config file - details_url: '#config' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: driver - value_type: string - description: | - Driver to use (available: `docker`, `docker-container`, `kubernetes`) - details_url: '#driver' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: driver-opt - value_type: stringArray - default_value: '[]' - description: Options for the driver - details_url: '#driver-opt' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: leave - value_type: bool - default_value: "false" - description: Remove a node from builder instead of changing it - details_url: '#leave' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: name - value_type: string - description: Builder instance name - details_url: '#name' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: node - value_type: string - description: Create/modify node with given name - details_url: '#node' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: platform - value_type: stringArray - default_value: '[]' - description: Fixed platforms for current node - details_url: '#platform' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: use - value_type: bool - default_value: "false" - description: Set the current builder instance - details_url: '#use' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: append + value_type: bool + default_value: "false" + description: Append a node to builder instead of changing it + details_url: '#append' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: bootstrap + value_type: bool + default_value: "false" + description: Boot builder after creation + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: buildkitd-flags + value_type: string + description: Flags for buildkitd daemon + details_url: '#buildkitd-flags' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: config + value_type: string + description: BuildKit config file + details_url: '#config' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: driver + value_type: string + description: | + Driver to use (available: `docker-container`, `kubernetes`, `remote`) + details_url: '#driver' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: driver-opt + value_type: stringArray + default_value: '[]' + description: Options for the driver + details_url: '#driver-opt' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: leave + value_type: bool + default_value: "false" + description: Remove a node from builder instead of changing it + details_url: '#leave' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: name + value_type: string + description: Builder instance name + details_url: '#name' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: node + value_type: string + description: Create/modify node with given name + details_url: '#node' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: platform + value_type: stringArray + default_value: '[]' + description: Fixed platforms for current node + details_url: '#platform' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: use + value_type: bool + default_value: "false" + description: Set the current builder instance + details_url: '#use' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Append a new node to an existing builder (--append) {#append} + ### Append a new node to an existing builder (--append) {#append} - The `--append` flag changes the action of the command to append a new node to an - existing builder specified by `--name`. Buildx will choose an appropriate node - for a build based on the platforms it supports. + The `--append` flag changes the action of the command to append a new node to an + existing builder specified by `--name`. Buildx will choose an appropriate node + for a build based on the platforms it supports. - ```console - $ docker buildx create mycontext1 - eager_beaver + ```console + $ docker buildx create mycontext1 + eager_beaver - $ docker buildx create --name eager_beaver --append mycontext2 - eager_beaver - ``` + $ docker buildx create --name eager_beaver --append mycontext2 + eager_beaver + ``` - ### Specify options for the buildkitd daemon (--buildkitd-flags) {#buildkitd-flags} + ### Specify options for the buildkitd daemon (--buildkitd-flags) {#buildkitd-flags} - ``` - --buildkitd-flags FLAGS - ``` + ``` + --buildkitd-flags FLAGS + ``` - Adds flags when starting the buildkitd daemon. They take precedence over the - configuration file specified by [`--config`](#config). See `buildkitd --help` - for the available flags. + Adds flags when starting the buildkitd daemon. They take precedence over the + configuration file specified by [`--config`](#config). See `buildkitd --help` + for the available flags. - ``` - --buildkitd-flags '--debug --debugaddr 0.0.0.0:6666' - ``` + ``` + --buildkitd-flags '--debug --debugaddr 0.0.0.0:6666' + ``` - ### Specify a configuration file for the buildkitd daemon (--config) {#config} + ### Specify a configuration file for the buildkitd daemon (--config) {#config} - ``` - --config FILE - ``` + ``` + --config FILE + ``` - Specifies the configuration file for the buildkitd daemon to use. The configuration - can be overridden by [`--buildkitd-flags`](#buildkitd-flags). - See an [example buildkitd configuration file](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md). + Specifies the configuration file for the buildkitd daemon to use. The configuration + can be overridden by [`--buildkitd-flags`](#buildkitd-flags). + See an [example buildkitd configuration file](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md). - Note that if you create a `docker-container` builder and have specified - certificates for registries in the `buildkitd.toml` configuration, the files - will be copied into the container under `/etc/buildkit/certs` and configuration - will be updated to reflect that. + If the configuration file is not specified, will look for one by default in: + * `$BUILDX_CONFIG/buildkitd.default.toml` + * `$DOCKER_CONFIG/buildx/buildkitd.default.toml` + * `~/.docker/buildx/buildkitd.default.toml` - ### Set the builder driver to use (--driver) {#driver} + Note that if you create a `docker-container` builder and have specified + certificates for registries in the `buildkitd.toml` configuration, the files + will be copied into the container under `/etc/buildkit/certs` and configuration + will be updated to reflect that. - ``` - --driver DRIVER - ``` + ### Set the builder driver to use (--driver) {#driver} - Sets the builder driver to be used. There are two available drivers, each have - their own specificities. + ``` + --driver DRIVER + ``` - #### `docker` driver + Sets the builder driver to be used. There are two available drivers, each have + their own specificities. - Uses the builder that is built into the docker daemon. With this driver, - the [`--load`](buildx_build.md#load) flag is implied by default on - `buildx build`. However, building multi-platform images or exporting cache is - not currently supported. + #### `docker` driver - #### `docker-container` driver + Uses the builder that is built into the docker daemon. With this driver, + the [`--load`](buildx_build.md#load) flag is implied by default on + `buildx build`. However, building multi-platform images or exporting cache is + not currently supported. - Uses a BuildKit container that will be spawned via docker. With this driver, - both building multi-platform images and exporting cache are supported. + #### `docker-container` driver - Unlike `docker` driver, built images will not automatically appear in - `docker images` and [`build --load`](buildx_build.md#load) needs to be used - to achieve that. + Uses a BuildKit container that will be spawned via docker. With this driver, + both building multi-platform images and exporting cache are supported. - #### `kubernetes` driver + Unlike `docker` driver, built images will not automatically appear in + `docker images` and [`build --load`](buildx_build.md#load) needs to be used + to achieve that. - Uses a kubernetes pods. With this driver, you can spin up pods with defined - BuildKit container image to build your images. + #### `kubernetes` driver - Unlike `docker` driver, built images will not automatically appear in - `docker images` and [`build --load`](buildx_build.md#load) needs to be used - to achieve that. + Uses a kubernetes pods. With this driver, you can spin up pods with defined + BuildKit container image to build your images. - ### Set additional driver-specific options (--driver-opt) {#driver-opt} + Unlike `docker` driver, built images will not automatically appear in + `docker images` and [`build --load`](buildx_build.md#load) needs to be used + to achieve that. - ``` - --driver-opt OPTIONS - ``` + #### `remote` driver - Passes additional driver-specific options. Details for each driver: + Uses a remote instance of buildkitd over an arbitrary connection. With this + driver, you manually create and manage instances of buildkit yourself, and + configure buildx to point at it. + + Unlike `docker` driver, built images will not automatically appear in + `docker images` and [`build --load`](buildx_build.md#load) needs to be used + to achieve that. + + ### Set additional driver-specific options (--driver-opt) {#driver-opt} + + ``` + --driver-opt OPTIONS + ``` + + Passes additional driver-specific options. + + Note: When using quoted values for example for the `nodeselector` or + `tolerations` options, ensure that quotes are escaped correctly for your shell. + + #### `docker` driver + + No driver options. + + #### `docker-container` driver - - `docker` - No driver options - - `docker-container` - `image=IMAGE` - Sets the container image to be used for running buildkit. - `network=NETMODE` - Sets the network mode for running the buildkit container. - `cgroup-parent=CGROUP` - Sets the cgroup parent of the buildkit container if docker is using the "cgroupfs" driver. Defaults to `/docker/buildx`. - - `kubernetes` + + #### `kubernetes` driver + - `image=IMAGE` - Sets the container image to be used for running buildkit. - `namespace=NS` - Sets the Kubernetes namespace. Defaults to the current namespace. - `replicas=N` - Sets the number of `Pod` replicas. Defaults to 1. @@ -239,62 +263,70 @@ examples: |- - `requests.memory` - Sets the request memory value specified in bytes or with a valid suffix. Example `requests.memory=500Mi`, `requests.memory=4G` - `limits.cpu` - Sets the limit CPU value specified in units of Kubernetes CPU. Example `limits.cpu=100m`, `limits.cpu=2` - `limits.memory` - Sets the limit memory value specified in bytes or with a valid suffix. Example `limits.memory=500Mi`, `limits.memory=4G` - - `nodeselector="label1=value1,label2=value2"` - Sets the kv of `Pod` nodeSelector. No Defaults. Example `nodeselector=kubernetes.io/arch=arm64` - - `rootless=(true|false)` - Run the container as a non-root user without `securityContext.privileged`. [Using Ubuntu host kernel is recommended](https://github.com/moby/buildkit/blob/master/docs/rootless.md). Defaults to false. + - `"nodeselector=label1=value1,label2=value2"` - Sets the kv of `Pod` nodeSelector. No Defaults. Example `nodeselector=kubernetes.io/arch=arm64` + - `"tolerations=key=foo,value=bar;key=foo2,operator=exists;key=foo3,effect=NoSchedule"` - Sets the `Pod` tolerations. Accepts the same values as the kube manifest tolera>tions. Key-value pairs are separated by `,`, tolerations are separated by `;`. No Defaults. Example `tolerations=operator=exists` + - `rootless=(true|false)` - Run the container as a non-root user without `securityContext.privileged`. Needs Kubernetes 1.19 or later. [Using Ubuntu host kernel is recommended](https://github.com/moby/buildkit/blob/master/docs/rootless.md). Defaults to false. - `loadbalance=(sticky|random)` - Load-balancing strategy. If set to "sticky", the pod is chosen using the hash of the context path. Defaults to "sticky" - `qemu.install=(true|false)` - Install QEMU emulation for multi platforms support. - `qemu.image=IMAGE` - Sets the QEMU emulation image. Defaults to `tonistiigi/binfmt:latest` - ### Remove a node from a builder (--leave) {#leave} + #### `remote` driver - The `--leave` flag changes the action of the command to remove a node from a - builder. The builder needs to be specified with `--name` and node that is removed - is set with `--node`. + - `key=KEY` - Sets the TLS client key. + - `cert=CERT` - Sets the TLS client certificate to present to buildkitd. + - `cacert=CACERT` - Sets the TLS certificate authority used for validation. + - `servername=SERVER` - Sets the TLS server name to be used in requests (defaults to the endpoint hostname). - ```console - $ docker buildx create --name mybuilder --node mybuilder0 --leave - ``` + ### Remove a node from a builder (--leave) {#leave} - ### Specify the name of the builder (--name) {#name} + The `--leave` flag changes the action of the command to remove a node from a + builder. The builder needs to be specified with `--name` and node that is removed + is set with `--node`. - ``` - --name NAME - ``` + ```console + $ docker buildx create --name mybuilder --node mybuilder0 --leave + ``` - The `--name` flag specifies the name of the builder to be created or modified. - If none is specified, one will be automatically generated. + ### Specify the name of the builder (--name) {#name} - ### Specify the name of the node (--node) {#node} + ``` + --name NAME + ``` - ``` - --node NODE - ``` + The `--name` flag specifies the name of the builder to be created or modified. + If none is specified, one will be automatically generated. - The `--node` flag specifies the name of the node to be created or modified. If - none is specified, it is the name of the builder it belongs to, with an index - number suffix. + ### Specify the name of the node (--node) {#node} - ### Set the platforms supported by the node (--platform) {#platform} + ``` + --node NODE + ``` - ``` - --platform PLATFORMS - ``` + The `--node` flag specifies the name of the node to be created or modified. If + none is specified, it is the name of the builder it belongs to, with an index + number suffix. - The `--platform` flag sets the platforms supported by the node. It expects a - comma-separated list of platforms of the form OS/architecture/variant. The node - will also automatically detect the platforms it supports, but manual values take - priority over the detected ones and can be used when multiple nodes support - building for the same platform. + ### Set the platforms supported by the node (--platform) {#platform} - ```console - $ docker buildx create --platform linux/amd64 - $ docker buildx create --platform linux/arm64,linux/arm/v8 - ``` + ``` + --platform PLATFORMS + ``` - ### Automatically switch to the newly created builder (--use) {#use} + The `--platform` flag sets the platforms supported by the node. It expects a + comma-separated list of platforms of the form OS/architecture/variant. The node + will also automatically detect the platforms it supports, but manual values take + priority over the detected ones and can be used when multiple nodes support + building for the same platform. - The `--use` flag automatically switches the current builder to the newly created - one. Equivalent to running `docker buildx use $(docker buildx create ...)`. + ```console + $ docker buildx create --platform linux/amd64 + $ docker buildx create --platform linux/arm64,linux/arm/v8 + ``` + + ### Automatically switch to the newly created builder (--use) {#use} + + The `--use` flag automatically switches the current builder to the newly created + one. Equivalent to running `docker buildx use $(docker buildx create ...)`. deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_du.yaml b/_data/buildx/docker_buildx_du.yaml index 32350b084f..4510acd4a9 100644 --- a/_data/buildx/docker_buildx_du.yaml +++ b/_data/buildx/docker_buildx_du.yaml @@ -5,40 +5,40 @@ usage: docker buildx du pname: docker buildx plink: docker_buildx.yaml options: -- option: filter - value_type: filter - description: Provide filter values - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: verbose - value_type: bool - default_value: "false" - description: Provide a more verbose output - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: filter + value_type: filter + description: Provide filter values + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: verbose + value_type: bool + default_value: "false" + description: Provide a more verbose output + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_imagetools.yaml b/_data/buildx/docker_buildx_imagetools.yaml index 3b44ae53db..607ec3a92f 100644 --- a/_data/buildx/docker_buildx_imagetools.yaml +++ b/_data/buildx/docker_buildx_imagetools.yaml @@ -1,31 +1,31 @@ command: docker buildx imagetools short: Commands to work on images in registry long: |- - Imagetools contains commands for working with manifest lists in the registry. - These commands are useful for inspecting multi-platform build results. + Imagetools contains commands for working with manifest lists in the registry. + These commands are useful for inspecting multi-platform build results. pname: docker buildx plink: docker_buildx.yaml cname: -- docker buildx imagetools create -- docker buildx imagetools inspect + - docker buildx imagetools create + - docker buildx imagetools inspect clink: -- docker_buildx_imagetools_create.yaml -- docker_buildx_imagetools_inspect.yaml + - docker_buildx_imagetools_create.yaml + - docker_buildx_imagetools_inspect.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_imagetools_create.yaml b/_data/buildx/docker_buildx_imagetools_create.yaml index 5d319cd3d9..a0ea1004bd 100644 --- a/_data/buildx/docker_buildx_imagetools_create.yaml +++ b/_data/buildx/docker_buildx_imagetools_create.yaml @@ -1,118 +1,129 @@ command: docker buildx imagetools create short: Create a new image based on source images long: |- - Create a new manifest list based on source manifests. The source manifests can - be manifest lists or single platform distribution manifests and must already - exist in the registry where the new manifest is created. If only one source is - specified, create performs a carbon copy. + Create a new manifest list based on source manifests. The source manifests can + be manifest lists or single platform distribution manifests and must already + exist in the registry where the new manifest is created. If only one source is + specified, create performs a carbon copy. usage: docker buildx imagetools create [OPTIONS] [SOURCE] [SOURCE...] pname: docker buildx imagetools plink: docker_buildx_imagetools.yaml options: -- option: append - value_type: bool - default_value: "false" - description: Append to existing manifest - details_url: '#append' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: dry-run - value_type: bool - default_value: "false" - description: Show final image instead of pushing - details_url: '#dry-run' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: file - shorthand: f - value_type: stringArray - default_value: '[]' - description: Read source descriptor from file - details_url: '#file' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: tag - shorthand: t - value_type: stringArray - default_value: '[]' - description: Set reference for new image - details_url: '#tag' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: append + value_type: bool + default_value: "false" + description: Append to existing manifest + details_url: '#append' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: dry-run + value_type: bool + default_value: "false" + description: Show final image instead of pushing + details_url: '#dry-run' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: file + shorthand: f + value_type: stringArray + default_value: '[]' + description: Read source descriptor from file + details_url: '#file' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: progress + value_type: string + default_value: auto + description: | + Set type of progress output (`auto`, `plain`, `tty`). Use plain to show container output + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: tag + shorthand: t + value_type: stringArray + default_value: '[]' + description: Set reference for new image + details_url: '#tag' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Append new sources to an existing manifest list (--append) {#append} + ### Append new sources to an existing manifest list (--append) {#append} - Use the `--append` flag to append the new sources to an existing manifest list - in the destination. + Use the `--append` flag to append the new sources to an existing manifest list + in the destination. - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). - ### Show final image instead of pushing (--dry-run) {#dry-run} + ### Show final image instead of pushing (--dry-run) {#dry-run} - Use the `--dry-run` flag to not push the image, just show it. + Use the `--dry-run` flag to not push the image, just show it. - ### Read source descriptor from a file (-f, --file) {#file} + ### Read source descriptor from a file (-f, --file) {#file} - ``` - -f FILE or --file FILE - ``` + ``` + -f FILE or --file FILE + ``` - Reads source from files. A source can be a manifest digest, manifest reference, - or a JSON of OCI descriptor object. + Reads source from files. A source can be a manifest digest, manifest reference, + or a JSON of OCI descriptor object. - In order to define annotations or additional platform properties like `os.version` and - `os.features` you need to add them in the OCI descriptor object encoded in JSON. + In order to define annotations or additional platform properties like `os.version` and + `os.features` you need to add them in the OCI descriptor object encoded in JSON. - ```console - $ docker buildx imagetools inspect --raw alpine | jq '.manifests[0] | .platform."os.version"="10.1"' > descr.json - $ docker buildx imagetools create -f descr.json myuser/image - ``` + ```console + $ docker buildx imagetools inspect --raw alpine | jq '.manifests[0] | .platform."os.version"="10.1"' > descr.json + $ docker buildx imagetools create -f descr.json myuser/image + ``` - The descriptor in the file is merged with existing descriptor in the registry if it exists. + The descriptor in the file is merged with existing descriptor in the registry if it exists. - The supported fields for the descriptor are defined in [OCI spec](https://github.com/opencontainers/image-spec/blob/master/descriptor.md#properties) . + The supported fields for the descriptor are defined in [OCI spec](https://github.com/opencontainers/image-spec/blob/master/descriptor.md#properties) . - ### Set reference for new image (-t, --tag) {#tag} + ### Set reference for new image (-t, --tag) {#tag} - ``` - -t IMAGE or --tag IMAGE - ``` + ``` + -t IMAGE or --tag IMAGE + ``` - Use the `-t` or `--tag` flag to set the name of the image to be created. + Use the `-t` or `--tag` flag to set the name of the image to be created. - ```console - $ docker buildx imagetools create --dry-run alpine@sha256:5c40b3c27b9f13c873fefb2139765c56ce97fd50230f1f2d5c91e55dec171907 sha256:c4ba6347b0e4258ce6a6de2401619316f982b7bcc529f73d2a410d0097730204 - $ docker buildx imagetools create -t tonistiigi/myapp -f image1 -f image2 - ``` + ```console + $ docker buildx imagetools create --dry-run alpine@sha256:5c40b3c27b9f13c873fefb2139765c56ce97fd50230f1f2d5c91e55dec171907 sha256:c4ba6347b0e4258ce6a6de2401619316f982b7bcc529f73d2a410d0097730204 + $ docker buildx imagetools create -t tonistiigi/myapp -f image1 -f image2 + ``` deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_imagetools_inspect.yaml b/_data/buildx/docker_buildx_imagetools_inspect.yaml index ad16409f54..2e2a02e2e6 100644 --- a/_data/buildx/docker_buildx_imagetools_inspect.yaml +++ b/_data/buildx/docker_buildx_imagetools_inspect.yaml @@ -1,440 +1,272 @@ command: docker buildx imagetools inspect short: Show details of an image in the registry long: |- - Show details of an image in the registry. + Show details of an image in the registry. - ```console - $ docker buildx imagetools inspect alpine - Name: docker.io/library/alpine:latest - MediaType: application/vnd.docker.distribution.manifest.list.v2+json - Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 + ```console + $ docker buildx imagetools inspect alpine + Name: docker.io/library/alpine:latest + MediaType: application/vnd.docker.distribution.manifest.list.v2+json + Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 - Manifests: - Name: docker.io/library/alpine:latest@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/amd64 + Manifests: + Name: docker.io/library/alpine:latest@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/amd64 - Name: docker.io/library/alpine:latest@sha256:e047bc2af17934d38c5a7fa9f46d443f1de3a7675546402592ef805cfa929f9d - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/arm/v6 + Name: docker.io/library/alpine:latest@sha256:e047bc2af17934d38c5a7fa9f46d443f1de3a7675546402592ef805cfa929f9d + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/arm/v6 - Name: docker.io/library/alpine:latest@sha256:8483ecd016885d8dba70426fda133c30466f661bb041490d525658f1aac73822 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/arm/v7 + Name: docker.io/library/alpine:latest@sha256:8483ecd016885d8dba70426fda133c30466f661bb041490d525658f1aac73822 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/arm/v7 - Name: docker.io/library/alpine:latest@sha256:c74f1b1166784193ea6c8f9440263b9be6cae07dfe35e32a5df7a31358ac2060 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/arm64/v8 + Name: docker.io/library/alpine:latest@sha256:c74f1b1166784193ea6c8f9440263b9be6cae07dfe35e32a5df7a31358ac2060 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/arm64/v8 - Name: docker.io/library/alpine:latest@sha256:2689e157117d2da668ad4699549e55eba1ceb79cb7862368b30919f0488213f4 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/386 + Name: docker.io/library/alpine:latest@sha256:2689e157117d2da668ad4699549e55eba1ceb79cb7862368b30919f0488213f4 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/386 - Name: docker.io/library/alpine:latest@sha256:2042a492bcdd847a01cd7f119cd48caa180da696ed2aedd085001a78664407d6 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/ppc64le + Name: docker.io/library/alpine:latest@sha256:2042a492bcdd847a01cd7f119cd48caa180da696ed2aedd085001a78664407d6 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/ppc64le - Name: docker.io/library/alpine:latest@sha256:49e322ab6690e73a4909f787bcbdb873631264ff4a108cddfd9f9c249ba1d58e - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/s390x - ``` + Name: docker.io/library/alpine:latest@sha256:49e322ab6690e73a4909f787bcbdb873631264ff4a108cddfd9f9c249ba1d58e + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/s390x + ``` usage: docker buildx imagetools inspect [OPTIONS] NAME pname: docker buildx imagetools plink: docker_buildx_imagetools.yaml options: -- option: format - value_type: string - default_value: '`{{.Manifest}}`' - description: Format the output using the given Go template - details_url: '#format' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: raw - value_type: bool - default_value: "false" - description: Show original, unformatted JSON manifest - details_url: '#raw' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: format + value_type: string + default_value: '`{{.Manifest}}`' + description: Format the output using the given Go template + details_url: '#format' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: raw + value_type: bool + default_value: "false" + description: Show original, unformatted JSON manifest + details_url: '#raw' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). - ### Format the output (--format) {#format} + ### Format the output (--format) {#format} - Format the output using the given Go template. Defaults to `{{.Manifest}}` if - unset. Following fields are available: + Format the output using the given Go template. Defaults to `{{.Manifest}}` if + unset. Following fields are available: - * `.Name`: provides the reference of the image - * `.Manifest`: provides the manifest or manifest list - * `.Image`: provides the image config - * `.BuildInfo`: provides [build info from image config](https://github.com/moby/buildkit/blob/master/docs/build-repro.md#image-config) + * `.Name`: provides the reference of the image + * `.Manifest`: provides the manifest or manifest list + * `.Image`: provides the image config + * `.BuildInfo`: provides [build info from image config](https://github.com/moby/buildkit/blob/master/docs/build-repro.md#image-config) - #### `.Name` + #### `.Name` - ```console - $ docker buildx imagetools inspect alpine --format "{{.Name}}" - Name: docker.io/library/alpine:latest - ``` + ```console + $ docker buildx imagetools inspect alpine --format "{{.Name}}" + Name: docker.io/library/alpine:latest + ``` - #### `.Manifest` + #### `.Manifest` - ```console - $ docker buildx imagetools inspect crazymax/loop --format "{{.Manifest}}" - Name: docker.io/crazymax/loop:latest - MediaType: application/vnd.docker.distribution.manifest.v2+json - Digest: sha256:08602e7340970e92bde5e0a2e887c1fde4d9ae753d1e05efb4c8ef3b609f97f1 - ``` - - ```console - $ docker buildx imagetools inspect moby/buildkit:master --format "{{.Manifest}}" - Name: docker.io/moby/buildkit:master - MediaType: application/vnd.docker.distribution.manifest.list.v2+json - Digest: sha256:3183f7ce54d1efb44c34b84f428ae10aaf141e553c6b52a7ff44cc7083a05a66 - - Manifests: - Name: docker.io/moby/buildkit:master@sha256:667d28c9fb33820ce686887a717a148e89fa77f9097f9352996bbcce99d352b1 + ```console + $ docker buildx imagetools inspect crazymax/loop --format "{{.Manifest}}" + Name: docker.io/crazymax/loop:latest MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/amd64 + Digest: sha256:08602e7340970e92bde5e0a2e887c1fde4d9ae753d1e05efb4c8ef3b609f97f1 + ``` - Name: docker.io/moby/buildkit:master@sha256:71789527b64ab3d7b3de01d364b449cd7f7a3da758218fbf73b9c9aae05a6775 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/arm/v7 + ```console + $ docker buildx imagetools inspect moby/buildkit:master --format "{{.Manifest}}" + Name: docker.io/moby/buildkit:master + MediaType: application/vnd.docker.distribution.manifest.list.v2+json + Digest: sha256:3183f7ce54d1efb44c34b84f428ae10aaf141e553c6b52a7ff44cc7083a05a66 - Name: docker.io/moby/buildkit:master@sha256:fb64667e1ce6ab0d05478f3a8402af07b27737598dcf9a510fb1d792b13a66be - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/arm64 + Manifests: + Name: docker.io/moby/buildkit:master@sha256:667d28c9fb33820ce686887a717a148e89fa77f9097f9352996bbcce99d352b1 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/amd64 - Name: docker.io/moby/buildkit:master@sha256:1c3ddf95a0788e23f72f25800c05abc4458946685e2b66788c3d978cde6da92b - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/s390x + Name: docker.io/moby/buildkit:master@sha256:71789527b64ab3d7b3de01d364b449cd7f7a3da758218fbf73b9c9aae05a6775 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/arm/v7 - Name: docker.io/moby/buildkit:master@sha256:05bcde6d460a284e5bc88026cd070277e8380355de3126cbc8fe8a452708c6b1 - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/ppc64le + Name: docker.io/moby/buildkit:master@sha256:fb64667e1ce6ab0d05478f3a8402af07b27737598dcf9a510fb1d792b13a66be + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/arm64 - Name: docker.io/moby/buildkit:master@sha256:c04c57765304ab84f4f9807fff3e11605c3a60e16435c734b02c723680f6bd6e - MediaType: application/vnd.docker.distribution.manifest.v2+json - Platform: linux/riscv64 - ``` + Name: docker.io/moby/buildkit:master@sha256:1c3ddf95a0788e23f72f25800c05abc4458946685e2b66788c3d978cde6da92b + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/s390x - #### `.BuildInfo` + Name: docker.io/moby/buildkit:master@sha256:05bcde6d460a284e5bc88026cd070277e8380355de3126cbc8fe8a452708c6b1 + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/ppc64le - ```console - $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{.BuildInfo}}" - Name: docker.io/crazymax/buildx:buildinfo - Frontend: dockerfile.v0 - Attrs: - filename: Dockerfile - source: docker/dockerfile-upstream:master-labs - build-arg:bar: foo - build-arg:foo: bar - Sources: - Type: docker-image - Ref: docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0 - Pin: sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0 + Name: docker.io/moby/buildkit:master@sha256:c04c57765304ab84f4f9807fff3e11605c3a60e16435c734b02c723680f6bd6e + MediaType: application/vnd.docker.distribution.manifest.v2+json + Platform: linux/riscv64 + ``` - Type: docker-image - Ref: docker.io/library/alpine:3.13 - Pin: sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c + #### `.BuildInfo` - Type: docker-image - Ref: docker.io/moby/buildkit:v0.9.0 - Pin: sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab + ```console + $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{.BuildInfo}}" + Name: docker.io/crazymax/buildx:buildinfo + Frontend: dockerfile.v0 + Attrs: + filename: Dockerfile + source: docker/dockerfile-upstream:master-labs + build-arg:bar: foo + build-arg:foo: bar + Sources: + Type: docker-image + Ref: docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0 + Pin: sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0 - Type: docker-image - Ref: docker.io/tonistiigi/xx@sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04 - Pin: sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04 + Type: docker-image + Ref: docker.io/library/alpine:3.13 + Pin: sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c - Type: http - Ref: https://raw.githubusercontent.com/moby/moby/master/README.md - Pin: sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c - ``` + Type: docker-image + Ref: docker.io/moby/buildkit:v0.9.0 + Pin: sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab - #### JSON output + Type: docker-image + Ref: docker.io/tonistiigi/xx@sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04 + Pin: sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04 - A `json` go template func is also available if you want to render fields as - JSON bytes: + Type: http + Ref: https://raw.githubusercontent.com/moby/moby/master/README.md + Pin: sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c + ``` - ```console - $ docker buildx imagetools inspect crazymax/loop --format "{{json .Manifest}}" - ``` - ```json - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:08602e7340970e92bde5e0a2e887c1fde4d9ae753d1e05efb4c8ef3b609f97f1", - "size": 949 - } - ``` + #### JSON output - ```console - $ docker buildx imagetools inspect moby/buildkit:master --format "{{json .Manifest}}" - ``` - ```json - { - "schemaVersion": 2, - "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", - "digest": "sha256:79d97f205e2799d99a3a8ae2a1ef17acb331e11784262c3faada847dc6972c52", - "size": 2010, - "manifests": [ - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:bd1e78f06de26610fadf4eb9d04b1a45a545799d6342701726e952cc0c11c912", - "size": 1158, - "platform": { - "architecture": "amd64", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:d37dcced63ec0965824fca644f0ac9efad8569434ec15b4c83adfcb3dcfc743b", - "size": 1158, - "platform": { - "architecture": "arm", - "os": "linux", - "variant": "v7" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:ce142eb2255e6af46f2809e159fd03081697c7605a3de03b9cbe9a52ddb244bf", - "size": 1158, - "platform": { - "architecture": "arm64", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:f59bfb5062fff76ce464bfa4e25ebaaaac887d6818238e119d68613c456d360c", - "size": 1158, - "platform": { - "architecture": "s390x", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:cc96426e0c50a78105d5637d31356db5dd6ec594f21b24276e534a32da09645c", - "size": 1159, - "platform": { - "architecture": "ppc64le", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:39f9c1e2878e6c333acb23187d6b205ce82ed934c60da326cb2c698192631478", - "size": 1158, - "platform": { - "architecture": "riscv64", - "os": "linux" - } - } - ] - } - ``` + A `json` go template func is also available if you want to render fields as + JSON bytes: - ```console - $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{json .BuildInfo}}" - ``` - ```json - { - "frontend": "dockerfile.v0", - "attrs": { - "build-arg:bar": "foo", - "build-arg:foo": "bar", - "filename": "Dockerfile", - "source": "crazymax/dockerfile:buildattrs" - }, - "sources": [ - { - "type": "docker-image", - "ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0", - "pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0" - }, - { - "type": "docker-image", - "ref": "docker.io/library/alpine:3.13@sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c", - "pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c" - }, - { - "type": "docker-image", - "ref": "docker.io/moby/buildkit:v0.9.0@sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab", - "pin": "sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab" - }, - { - "type": "docker-image", - "ref": "docker.io/tonistiigi/xx@sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04", - "pin": "sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04" - }, - { - "type": "http", - "ref": "https://raw.githubusercontent.com/moby/moby/master/README.md", - "pin": "sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c" - } - ] - } - ``` - - ```console - $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{json .}}" - ``` - ```json - { - "name": "crazymax/buildx:buildinfo", - "manifest": { + ```console + $ docker buildx imagetools inspect crazymax/loop --format "{{json .Manifest}}" + ``` + ```json + { "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:899d2c7acbc124d406820857bb51d9089717bbe4e22b97eb4bc5789e99f09f83", - "size": 2628 - }, - "image": { - "created": "2022-02-24T12:27:43.627154558Z", - "architecture": "amd64", - "os": "linux", - "config": { - "Env": [ - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", - "DOCKER_TLS_CERTDIR=/certs", - "DOCKER_CLI_EXPERIMENTAL=enabled" - ], - "Entrypoint": [ - "docker-entrypoint.sh" - ], - "Cmd": [ - "sh" - ] - }, - "rootfs": { - "type": "layers", - "diff_ids": [ - "sha256:7fcb75871b2101082203959c83514ac8a9f4ecfee77a0fe9aa73bbe56afdf1b4", - "sha256:d3c0b963ff5684160641f936d6a4aa14efc8ff27b6edac255c07f2d03ff92e82", - "sha256:3f8d78f13fa9b1f35d3bc3f1351d03a027c38018c37baca73f93eecdea17f244", - "sha256:8e6eb1137b182ae0c3f5d40ca46341fda2eaeeeb5fa516a9a2bf96171238e2e0", - "sha256:fde4c869a56b54dd76d7352ddaa813fd96202bda30b9dceb2c2f2ad22fa2e6ce", - "sha256:52025823edb284321af7846419899234b3c66219bf06061692b709875ed0760f", - "sha256:50adb5982dbf6126c7cf279ac3181d1e39fc9116b610b947a3dadae6f7e7c5bc", - "sha256:9801c319e1c66c5d295e78b2d3e80547e73c7e3c63a4b71e97c8ca357224af24", - "sha256:dfbfac44d5d228c49b42194c8a2f470abd6916d072f612a6fb14318e94fde8ae", - "sha256:3dfb74e19dedf61568b917c19b0fd3ee4580870027ca0b6054baf239855d1322", - "sha256:b182e707c23e4f19be73f9022a99d2d1ca7bf1ca8f280d40e4d1c10a6f51550e" - ] - }, - "history": [ + "digest": "sha256:08602e7340970e92bde5e0a2e887c1fde4d9ae753d1e05efb4c8ef3b609f97f1", + "size": 949 + } + ``` + + ```console + $ docker buildx imagetools inspect moby/buildkit:master --format "{{json .Manifest}}" + ``` + ```json + { + "schemaVersion": 2, + "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", + "digest": "sha256:79d97f205e2799d99a3a8ae2a1ef17acb331e11784262c3faada847dc6972c52", + "size": 2010, + "manifests": [ { - "created": "2021-11-12T17:19:58.698676655Z", - "created_by": "/bin/sh -c #(nop) ADD file:5a707b9d6cb5fff532e4c2141bc35707593f21da5528c9e71ae2ddb6ba4a4eb6 in / " + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:bd1e78f06de26610fadf4eb9d04b1a45a545799d6342701726e952cc0c11c912", + "size": 1158, + "platform": { + "architecture": "amd64", + "os": "linux" + } }, { - "created": "2021-11-12T17:19:58.948920855Z", - "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", - "empty_layer": true + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:d37dcced63ec0965824fca644f0ac9efad8569434ec15b4c83adfcb3dcfc743b", + "size": 1158, + "platform": { + "architecture": "arm", + "os": "linux", + "variant": "v7" + } }, { - "created": "2022-02-24T12:27:38.285594601Z", - "created_by": "RUN /bin/sh -c apk --update --no-cache add bash ca-certificates openssh-client \u0026\u0026 rm -rf /tmp/* /var/cache/apk/* # buildkit", - "comment": "buildkit.dockerfile.v0" + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:ce142eb2255e6af46f2809e159fd03081697c7605a3de03b9cbe9a52ddb244bf", + "size": 1158, + "platform": { + "architecture": "arm64", + "os": "linux" + } }, { - "created": "2022-02-24T12:27:41.061874167Z", - "created_by": "COPY /opt/docker/ /usr/local/bin/ # buildkit", - "comment": "buildkit.dockerfile.v0" + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:f59bfb5062fff76ce464bfa4e25ebaaaac887d6818238e119d68613c456d360c", + "size": 1158, + "platform": { + "architecture": "s390x", + "os": "linux" + } }, { - "created": "2022-02-24T12:27:41.174098947Z", - "created_by": "COPY /usr/bin/buildctl /usr/local/bin/buildctl # buildkit", - "comment": "buildkit.dockerfile.v0" + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:cc96426e0c50a78105d5637d31356db5dd6ec594f21b24276e534a32da09645c", + "size": 1159, + "platform": { + "architecture": "ppc64le", + "os": "linux" + } }, { - "created": "2022-02-24T12:27:41.320343683Z", - "created_by": "COPY /usr/bin/buildkit* /usr/local/bin/ # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:41.447149933Z", - "created_by": "COPY /buildx /usr/libexec/docker/cli-plugins/docker-buildx # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.057722191Z", - "created_by": "COPY /opt/docker-compose /usr/libexec/docker/cli-plugins/docker-compose # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.145224134Z", - "created_by": "ADD https://raw.githubusercontent.com/moby/moby/master/README.md / # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.422212427Z", - "created_by": "ENV DOCKER_TLS_CERTDIR=/certs", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true - }, - { - "created": "2022-02-24T12:27:43.422212427Z", - "created_by": "ENV DOCKER_CLI_EXPERIMENTAL=enabled", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true - }, - { - "created": "2022-02-24T12:27:43.422212427Z", - "created_by": "RUN /bin/sh -c docker --version \u0026\u0026 buildkitd --version \u0026\u0026 buildctl --version \u0026\u0026 docker buildx version \u0026\u0026 docker compose version \u0026\u0026 mkdir /certs /certs/client \u0026\u0026 chmod 1777 /certs /certs/client # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.514320155Z", - "created_by": "COPY rootfs/modprobe.sh /usr/local/bin/modprobe # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.627154558Z", - "created_by": "COPY rootfs/docker-entrypoint.sh /usr/local/bin/ # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T12:27:43.627154558Z", - "created_by": "ENTRYPOINT [\"docker-entrypoint.sh\"]", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true - }, - { - "created": "2022-02-24T12:27:43.627154558Z", - "created_by": "CMD [\"sh\"]", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:39f9c1e2878e6c333acb23187d6b205ce82ed934c60da326cb2c698192631478", + "size": 1158, + "platform": { + "architecture": "riscv64", + "os": "linux" + } } ] - }, - "buildinfo": { + } + ``` + + ```console + $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{json .BuildInfo}}" + ``` + ```json + { "frontend": "dockerfile.v0", "attrs": { "build-arg:bar": "foo", "build-arg:foo": "bar", "filename": "Dockerfile", - "source": "docker/dockerfile-upstream:master-labs" + "source": "crazymax/dockerfile:buildattrs" }, "sources": [ { @@ -444,12 +276,12 @@ examples: |- }, { "type": "docker-image", - "ref": "docker.io/library/alpine:3.13", + "ref": "docker.io/library/alpine:3.13@sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c", "pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c" }, { "type": "docker-image", - "ref": "docker.io/moby/buildkit:v0.9.0", + "ref": "docker.io/moby/buildkit:v0.9.0@sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab", "pin": "sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab" }, { @@ -464,188 +296,356 @@ examples: |- } ] } - } - ``` + ``` - #### Multi-platform - - Multi-platform images are supported for `.Image` and `.BuildInfo` fields. If - you want to pick up a specific platform, you can specify it using the `index` - go template function: - - ```console - $ docker buildx imagetools inspect --format '{{json (index .Image "linux/s390x")}}' moby/buildkit:master - ``` - ```json - { - "created": "2022-02-25T17:13:27.89891722Z", - "architecture": "s390x", - "os": "linux", - "config": { - "Env": [ - "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" - ], - "Entrypoint": [ - "buildkitd" - ], - "Volumes": { - "/var/lib/buildkit": {} + ```console + $ docker buildx imagetools inspect crazymax/buildx:buildinfo --format "{{json .}}" + ``` + ```json + { + "name": "crazymax/buildx:buildinfo", + "manifest": { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:899d2c7acbc124d406820857bb51d9089717bbe4e22b97eb4bc5789e99f09f83", + "size": 2628 + }, + "image": { + "created": "2022-02-24T12:27:43.627154558Z", + "architecture": "amd64", + "os": "linux", + "config": { + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", + "DOCKER_TLS_CERTDIR=/certs", + "DOCKER_CLI_EXPERIMENTAL=enabled" + ], + "Entrypoint": [ + "docker-entrypoint.sh" + ], + "Cmd": [ + "sh" + ] + }, + "rootfs": { + "type": "layers", + "diff_ids": [ + "sha256:7fcb75871b2101082203959c83514ac8a9f4ecfee77a0fe9aa73bbe56afdf1b4", + "sha256:d3c0b963ff5684160641f936d6a4aa14efc8ff27b6edac255c07f2d03ff92e82", + "sha256:3f8d78f13fa9b1f35d3bc3f1351d03a027c38018c37baca73f93eecdea17f244", + "sha256:8e6eb1137b182ae0c3f5d40ca46341fda2eaeeeb5fa516a9a2bf96171238e2e0", + "sha256:fde4c869a56b54dd76d7352ddaa813fd96202bda30b9dceb2c2f2ad22fa2e6ce", + "sha256:52025823edb284321af7846419899234b3c66219bf06061692b709875ed0760f", + "sha256:50adb5982dbf6126c7cf279ac3181d1e39fc9116b610b947a3dadae6f7e7c5bc", + "sha256:9801c319e1c66c5d295e78b2d3e80547e73c7e3c63a4b71e97c8ca357224af24", + "sha256:dfbfac44d5d228c49b42194c8a2f470abd6916d072f612a6fb14318e94fde8ae", + "sha256:3dfb74e19dedf61568b917c19b0fd3ee4580870027ca0b6054baf239855d1322", + "sha256:b182e707c23e4f19be73f9022a99d2d1ca7bf1ca8f280d40e4d1c10a6f51550e" + ] + }, + "history": [ + { + "created": "2021-11-12T17:19:58.698676655Z", + "created_by": "/bin/sh -c #(nop) ADD file:5a707b9d6cb5fff532e4c2141bc35707593f21da5528c9e71ae2ddb6ba4a4eb6 in / " + }, + { + "created": "2021-11-12T17:19:58.948920855Z", + "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", + "empty_layer": true + }, + { + "created": "2022-02-24T12:27:38.285594601Z", + "created_by": "RUN /bin/sh -c apk --update --no-cache add bash ca-certificates openssh-client \u0026\u0026 rm -rf /tmp/* /var/cache/apk/* # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:41.061874167Z", + "created_by": "COPY /opt/docker/ /usr/local/bin/ # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:41.174098947Z", + "created_by": "COPY /usr/bin/buildctl /usr/local/bin/buildctl # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:41.320343683Z", + "created_by": "COPY /usr/bin/buildkit* /usr/local/bin/ # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:41.447149933Z", + "created_by": "COPY /buildx /usr/libexec/docker/cli-plugins/docker-buildx # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.057722191Z", + "created_by": "COPY /opt/docker-compose /usr/libexec/docker/cli-plugins/docker-compose # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.145224134Z", + "created_by": "ADD https://raw.githubusercontent.com/moby/moby/master/README.md / # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.422212427Z", + "created_by": "ENV DOCKER_TLS_CERTDIR=/certs", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + }, + { + "created": "2022-02-24T12:27:43.422212427Z", + "created_by": "ENV DOCKER_CLI_EXPERIMENTAL=enabled", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + }, + { + "created": "2022-02-24T12:27:43.422212427Z", + "created_by": "RUN /bin/sh -c docker --version \u0026\u0026 buildkitd --version \u0026\u0026 buildctl --version \u0026\u0026 docker buildx version \u0026\u0026 docker compose version \u0026\u0026 mkdir /certs /certs/client \u0026\u0026 chmod 1777 /certs /certs/client # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.514320155Z", + "created_by": "COPY rootfs/modprobe.sh /usr/local/bin/modprobe # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.627154558Z", + "created_by": "COPY rootfs/docker-entrypoint.sh /usr/local/bin/ # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T12:27:43.627154558Z", + "created_by": "ENTRYPOINT [\"docker-entrypoint.sh\"]", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + }, + { + "created": "2022-02-24T12:27:43.627154558Z", + "created_by": "CMD [\"sh\"]", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + } + ] + }, + "buildinfo": { + "frontend": "dockerfile.v0", + "attrs": { + "build-arg:bar": "foo", + "build-arg:foo": "bar", + "filename": "Dockerfile", + "source": "docker/dockerfile-upstream:master-labs" + }, + "sources": [ + { + "type": "docker-image", + "ref": "docker.io/docker/buildx-bin:0.6.1@sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0", + "pin": "sha256:a652ced4a4141977c7daaed0a074dcd9844a78d7d2615465b12f433ae6dd29f0" + }, + { + "type": "docker-image", + "ref": "docker.io/library/alpine:3.13", + "pin": "sha256:026f721af4cf2843e07bba648e158fb35ecc876d822130633cc49f707f0fc88c" + }, + { + "type": "docker-image", + "ref": "docker.io/moby/buildkit:v0.9.0", + "pin": "sha256:8dc668e7f66db1c044aadbed306020743516a94848793e0f81f94a087ee78cab" + }, + { + "type": "docker-image", + "ref": "docker.io/tonistiigi/xx@sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04", + "pin": "sha256:21a61be4744f6531cb5f33b0e6f40ede41fa3a1b8c82d5946178f80cc84bfc04" + }, + { + "type": "http", + "ref": "https://raw.githubusercontent.com/moby/moby/master/README.md", + "pin": "sha256:419455202b0ef97e480d7f8199b26a721a417818bc0e2d106975f74323f25e6c" + } + ] } - }, - "rootfs": { - "type": "layers", - "diff_ids": [ - "sha256:41048e32d0684349141cf05f629c5fc3c5915d1f3426b66dbb8953a540e01e1e", - "sha256:2651209b9208fff6c053bc3c17353cb07874e50f1a9bc96d6afd03aef63de76a", - "sha256:6741ed7e73039d853fa8902246a4c7e8bf9dd09652fd1b08251bc5f9e8876a7f", - "sha256:92ac046adeeb65c86ae3f0b458dee04ad4a462e417661c04d77642c66494f69b" + } + ``` + + #### Multi-platform + + Multi-platform images are supported for `.Image` and `.BuildInfo` fields. If + you want to pick up a specific platform, you can specify it using the `index` + go template function: + + ```console + $ docker buildx imagetools inspect --format '{{json (index .Image "linux/s390x")}}' moby/buildkit:master + ``` + ```json + { + "created": "2022-02-25T17:13:27.89891722Z", + "architecture": "s390x", + "os": "linux", + "config": { + "Env": [ + "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" + ], + "Entrypoint": [ + "buildkitd" + ], + "Volumes": { + "/var/lib/buildkit": {} + } + }, + "rootfs": { + "type": "layers", + "diff_ids": [ + "sha256:41048e32d0684349141cf05f629c5fc3c5915d1f3426b66dbb8953a540e01e1e", + "sha256:2651209b9208fff6c053bc3c17353cb07874e50f1a9bc96d6afd03aef63de76a", + "sha256:6741ed7e73039d853fa8902246a4c7e8bf9dd09652fd1b08251bc5f9e8876a7f", + "sha256:92ac046adeeb65c86ae3f0b458dee04ad4a462e417661c04d77642c66494f69b" + ] + }, + "history": [ + { + "created": "2021-11-24T20:41:23.709681315Z", + "created_by": "/bin/sh -c #(nop) ADD file:cd24c711a2ef431b3ff94f9a02bfc42f159bc60de1d0eceecafea4e8af02441d in / " + }, + { + "created": "2021-11-24T20:41:23.94211262Z", + "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", + "empty_layer": true + }, + { + "created": "2022-01-26T18:15:21.449825391Z", + "created_by": "RUN /bin/sh -c apk add --no-cache fuse3 git openssh pigz xz \u0026\u0026 ln -s fusermount3 /usr/bin/fusermount # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-24T00:34:00.924540012Z", + "created_by": "COPY examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/ # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-25T17:13:27.89891722Z", + "created_by": "VOLUME [/var/lib/buildkit]", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + }, + { + "created": "2022-02-25T17:13:27.89891722Z", + "created_by": "COPY / /usr/bin/ # buildkit", + "comment": "buildkit.dockerfile.v0" + }, + { + "created": "2022-02-25T17:13:27.89891722Z", + "created_by": "ENTRYPOINT [\"buildkitd\"]", + "comment": "buildkit.dockerfile.v0", + "empty_layer": true + } ] - }, - "history": [ - { - "created": "2021-11-24T20:41:23.709681315Z", - "created_by": "/bin/sh -c #(nop) ADD file:cd24c711a2ef431b3ff94f9a02bfc42f159bc60de1d0eceecafea4e8af02441d in / " - }, - { - "created": "2021-11-24T20:41:23.94211262Z", - "created_by": "/bin/sh -c #(nop) CMD [\"/bin/sh\"]", - "empty_layer": true - }, - { - "created": "2022-01-26T18:15:21.449825391Z", - "created_by": "RUN /bin/sh -c apk add --no-cache fuse3 git openssh pigz xz \u0026\u0026 ln -s fusermount3 /usr/bin/fusermount # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-24T00:34:00.924540012Z", - "created_by": "COPY examples/buildctl-daemonless/buildctl-daemonless.sh /usr/bin/ # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-25T17:13:27.89891722Z", - "created_by": "VOLUME [/var/lib/buildkit]", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true - }, - { - "created": "2022-02-25T17:13:27.89891722Z", - "created_by": "COPY / /usr/bin/ # buildkit", - "comment": "buildkit.dockerfile.v0" - }, - { - "created": "2022-02-25T17:13:27.89891722Z", - "created_by": "ENTRYPOINT [\"buildkitd\"]", - "comment": "buildkit.dockerfile.v0", - "empty_layer": true - } - ] - } - ``` + } + ``` - ### Show original, unformatted JSON manifest (--raw) {#raw} + ### Show original, unformatted JSON manifest (--raw) {#raw} - Use the `--raw` option to print the unformatted JSON manifest bytes. + Use the `--raw` option to print the unformatted JSON manifest bytes. - > `jq` is used here to get a better rendering of the output result. + > `jq` is used here to get a better rendering of the output result. - ```console - $ docker buildx imagetools inspect --raw crazymax/loop | jq - ``` - ```json - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "schemaVersion": 2, - "config": { - "mediaType": "application/vnd.docker.container.image.v1+json", - "digest": "sha256:7ace7d324e79b360b2db8b820d83081863d96d22e734cdf297a8e7fd83f6ceb3", - "size": 2298 - }, - "layers": [ - { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b", - "size": 2811478 + ```console + $ docker buildx imagetools inspect --raw crazymax/loop | jq + ``` + ```json + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "schemaVersion": 2, + "config": { + "mediaType": "application/vnd.docker.container.image.v1+json", + "digest": "sha256:7ace7d324e79b360b2db8b820d83081863d96d22e734cdf297a8e7fd83f6ceb3", + "size": 2298 }, - { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:726d3732a87e1c430d67e8969de6b222a889d45e045ebae1a008a37ba38f3b1f", - "size": 1776812 - }, - { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "digest": "sha256:5d7cf9b33148a8f220c84f27dd2cfae46aca019a3ea3fbf7274f6d6dbfae8f3b", - "size": 382855 - } - ] - } - ``` + "layers": [ + { + "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", + "digest": "sha256:5843afab387455b37944e709ee8c78d7520df80f8d01cf7f861aae63beeddb6b", + "size": 2811478 + }, + { + "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", + "digest": "sha256:726d3732a87e1c430d67e8969de6b222a889d45e045ebae1a008a37ba38f3b1f", + "size": 1776812 + }, + { + "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", + "digest": "sha256:5d7cf9b33148a8f220c84f27dd2cfae46aca019a3ea3fbf7274f6d6dbfae8f3b", + "size": 382855 + } + ] + } + ``` - ```console - $ docker buildx imagetools inspect --raw moby/buildkit:master | jq - ``` - ```json - { - "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", - "schemaVersion": 2, - "manifests": [ - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:667d28c9fb33820ce686887a717a148e89fa77f9097f9352996bbcce99d352b1", - "size": 1158, - "platform": { - "architecture": "amd64", - "os": "linux" + ```console + $ docker buildx imagetools inspect --raw moby/buildkit:master | jq + ``` + ```json + { + "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json", + "schemaVersion": 2, + "manifests": [ + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:667d28c9fb33820ce686887a717a148e89fa77f9097f9352996bbcce99d352b1", + "size": 1158, + "platform": { + "architecture": "amd64", + "os": "linux" + } + }, + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:71789527b64ab3d7b3de01d364b449cd7f7a3da758218fbf73b9c9aae05a6775", + "size": 1158, + "platform": { + "architecture": "arm", + "os": "linux", + "variant": "v7" + } + }, + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:fb64667e1ce6ab0d05478f3a8402af07b27737598dcf9a510fb1d792b13a66be", + "size": 1158, + "platform": { + "architecture": "arm64", + "os": "linux" + } + }, + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:1c3ddf95a0788e23f72f25800c05abc4458946685e2b66788c3d978cde6da92b", + "size": 1158, + "platform": { + "architecture": "s390x", + "os": "linux" + } + }, + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:05bcde6d460a284e5bc88026cd070277e8380355de3126cbc8fe8a452708c6b1", + "size": 1159, + "platform": { + "architecture": "ppc64le", + "os": "linux" + } + }, + { + "mediaType": "application/vnd.docker.distribution.manifest.v2+json", + "digest": "sha256:c04c57765304ab84f4f9807fff3e11605c3a60e16435c734b02c723680f6bd6e", + "size": 1158, + "platform": { + "architecture": "riscv64", + "os": "linux" + } } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:71789527b64ab3d7b3de01d364b449cd7f7a3da758218fbf73b9c9aae05a6775", - "size": 1158, - "platform": { - "architecture": "arm", - "os": "linux", - "variant": "v7" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:fb64667e1ce6ab0d05478f3a8402af07b27737598dcf9a510fb1d792b13a66be", - "size": 1158, - "platform": { - "architecture": "arm64", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:1c3ddf95a0788e23f72f25800c05abc4458946685e2b66788c3d978cde6da92b", - "size": 1158, - "platform": { - "architecture": "s390x", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:05bcde6d460a284e5bc88026cd070277e8380355de3126cbc8fe8a452708c6b1", - "size": 1159, - "platform": { - "architecture": "ppc64le", - "os": "linux" - } - }, - { - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "digest": "sha256:c04c57765304ab84f4f9807fff3e11605c3a60e16435c734b02c723680f6bd6e", - "size": 1158, - "platform": { - "architecture": "riscv64", - "os": "linux" - } - } - ] - } - ``` + ] + } + ``` deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_inspect.yaml b/_data/buildx/docker_buildx_inspect.yaml index a47bba0dcf..7cbf21a048 100644 --- a/_data/buildx/docker_buildx_inspect.yaml +++ b/_data/buildx/docker_buildx_inspect.yaml @@ -5,66 +5,72 @@ usage: docker buildx inspect [NAME] pname: docker buildx plink: docker_buildx.yaml options: -- option: bootstrap - value_type: bool - default_value: "false" - description: Ensure builder has booted before inspecting - details_url: '#bootstrap' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: bootstrap + value_type: bool + default_value: "false" + description: Ensure builder has booted before inspecting + details_url: '#bootstrap' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Ensure that the builder is running before inspecting (--bootstrap) {#bootstrap} + ### Ensure that the builder is running before inspecting (--bootstrap) {#bootstrap} - Use the `--bootstrap` option to ensure that the builder is running before - inspecting it. If the driver is `docker-container`, then `--bootstrap` starts - the buildkit container and waits until it is operational. Bootstrapping is - automatically done during build, and therefore not necessary. The same BuildKit - container is used during the lifetime of the associated builder node (as - displayed in `buildx ls`). + Use the `--bootstrap` option to ensure that the builder is running before + inspecting it. If the driver is `docker-container`, then `--bootstrap` starts + the buildkit container and waits until it is operational. Bootstrapping is + automatically done during build, and therefore not necessary. The same BuildKit + container is used during the lifetime of the associated builder node (as + displayed in `buildx ls`). - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). - ### Get information about a builder instance + ### Get information about a builder instance - By default, `inspect` shows information about the current builder. Specify the - name of the builder to inspect to get information about that builder. - The following example shows information about a builder instance named - `elated_tesla`: + By default, `inspect` shows information about the current builder. Specify the + name of the builder to inspect to get information about that builder. + The following example shows information about a builder instance named + `elated_tesla`: - ```console - $ docker buildx inspect elated_tesla + > **Note** + > + > Asterisk `*` next to node build platform(s) indicate they had been set manually during `buildx create`. Otherwise, it had been autodetected. - Name: elated_tesla - Driver: docker-container + ```console + $ docker buildx inspect elated_tesla - Nodes: - Name: elated_tesla0 - Endpoint: unix:///var/run/docker.sock - Status: running - Platforms: linux/amd64 + Name: elated_tesla + Driver: docker-container - Name: elated_tesla1 - Endpoint: ssh://ubuntu@1.2.3.4 - Status: running - Platforms: linux/arm64, linux/arm/v7, linux/arm/v6 - ``` + Nodes: + Name: elated_tesla0 + Endpoint: unix:///var/run/docker.sock + Status: running + Buildkit: v0.10.3 + Platforms: linux/amd64 + + Name: elated_tesla1 + Endpoint: ssh://ubuntu@1.2.3.4 + Status: running + Buildkit: v0.10.3 + Platforms: linux/arm64*, linux/arm/v7, linux/arm/v6 + ``` deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_install.yaml b/_data/buildx/docker_buildx_install.yaml index 4505430685..4e8ed387ef 100644 --- a/_data/buildx/docker_buildx_install.yaml +++ b/_data/buildx/docker_buildx_install.yaml @@ -5,15 +5,15 @@ usage: docker buildx install pname: docker buildx plink: docker_buildx.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_ls.yaml b/_data/buildx/docker_buildx_ls.yaml index bbe0509043..00b3514b28 100644 --- a/_data/buildx/docker_buildx_ls.yaml +++ b/_data/buildx/docker_buildx_ls.yaml @@ -1,35 +1,34 @@ command: docker buildx ls short: List builder instances long: |- - Lists all builder instances and the nodes for each instance + Lists all builder instances and the nodes for each instance - ```console - $ docker buildx ls + ```console + $ docker buildx ls + NAME/NODE DRIVER/ENDPOINT STATUS BUILDKIT PLATFORMS + elated_tesla * docker-container + elated_tesla0 unix:///var/run/docker.sock running v0.10.3 linux/amd64 + elated_tesla1 ssh://ubuntu@1.2.3.4 running v0.10.3 linux/arm64*, linux/arm/v7, linux/arm/v6 + default docker + default default running 20.10.14 linux/amd64 + ``` - NAME/NODE DRIVER/ENDPOINT STATUS PLATFORMS - elated_tesla * docker-container - elated_tesla0 unix:///var/run/docker.sock running linux/amd64 - elated_tesla1 ssh://ubuntu@1.2.3.4 running linux/arm64*, linux/arm/v7, linux/arm/v6 - default docker - default default running linux/amd64 - ``` - - Each builder has one or more nodes associated with it. The current builder's - name is marked with a `*` in `NAME/NODE` and explicit node to build against for - the target platform marked with a `*` in the `PLATFORMS` column. + Each builder has one or more nodes associated with it. The current builder's + name is marked with a `*` in `NAME/NODE` and explicit node to build against for + the target platform marked with a `*` in the `PLATFORMS` column. usage: docker buildx ls pname: docker buildx plink: docker_buildx.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_prune.yaml b/_data/buildx/docker_buildx_prune.yaml index 43ca9074fd..c710c6e171 100644 --- a/_data/buildx/docker_buildx_prune.yaml +++ b/_data/buildx/docker_buildx_prune.yaml @@ -1,76 +1,93 @@ command: docker buildx prune short: Remove build cache -long: Remove build cache +long: |- + Clears the build cache of the selected builder. + + You can finely control what cache data is kept using: + + - The `--filter=until=` flag to keep images that have been used in + the last `` time. + + `` is a duration string, e.g. `24h` or `2h30m`, with allowable + units of `(h)ours`, `(m)inutes` and `(s)econds`. + + - The `--keep-storage=` flag to keep `` bytes of data in the cache. + + `` is a human-readable memory string, e.g. `128mb`, `2gb`, etc. Units + are case-insensitive. + + - The `--all` flag to allow clearing internal helper images and frontend images + set using the `#syntax=` directive or the `BUILDKIT_SYNTAX` build argument. usage: docker buildx prune pname: docker buildx plink: docker_buildx.yaml options: -- option: all - shorthand: a - value_type: bool - default_value: "false" - description: Remove all unused images, not just dangling ones - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: filter - value_type: filter - description: Provide filter values (e.g., `until=24h`) - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: force - shorthand: f - value_type: bool - default_value: "false" - description: Do not prompt for confirmation - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: keep-storage - value_type: bytes - default_value: "0" - description: Amount of disk space to keep for cache - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: verbose - value_type: bool - default_value: "false" - description: Provide a more verbose output - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: all + shorthand: a + value_type: bool + default_value: "false" + description: Include internal/frontend images + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: filter + value_type: filter + description: Provide filter values (e.g., `until=24h`) + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: force + shorthand: f + value_type: bool + default_value: "false" + description: Do not prompt for confirmation + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: keep-storage + value_type: bytes + default_value: "0" + description: Amount of disk space to keep for cache + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: verbose + value_type: bool + default_value: "false" + description: Provide a more verbose output + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_rm.yaml b/_data/buildx/docker_buildx_rm.yaml index 2c730bba46..ca504889b0 100644 --- a/_data/buildx/docker_buildx_rm.yaml +++ b/_data/buildx/docker_buildx_rm.yaml @@ -1,99 +1,99 @@ command: docker buildx rm short: Remove a builder instance long: |- - Removes the specified or current builder. It is a no-op attempting to remove the - default builder. + Removes the specified or current builder. It is a no-op attempting to remove the + default builder. usage: docker buildx rm [NAME] pname: docker buildx plink: docker_buildx.yaml options: -- option: all-inactive - value_type: bool - default_value: "false" - description: Remove all inactive builders - details_url: '#all-inactive' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: force - shorthand: f - value_type: bool - default_value: "false" - description: Do not prompt for confirmation - details_url: '#force' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: keep-daemon - value_type: bool - default_value: "false" - description: Keep the buildkitd daemon running - details_url: '#keep-daemon' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: keep-state - value_type: bool - default_value: "false" - description: Keep BuildKit state - details_url: '#keep-state' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: all-inactive + value_type: bool + default_value: "false" + description: Remove all inactive builders + details_url: '#all-inactive' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: force + shorthand: f + value_type: bool + default_value: "false" + description: Do not prompt for confirmation + details_url: '#force' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: keep-daemon + value_type: bool + default_value: "false" + description: Keep the buildkitd daemon running + details_url: '#keep-daemon' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: keep-state + value_type: bool + default_value: "false" + description: Keep BuildKit state + details_url: '#keep-state' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Remove all inactive builders (--all-inactive) {#all-inactive} + ### Remove all inactive builders (--all-inactive) {#all-inactive} - Remove builders that are not in running state. + Remove builders that are not in running state. - ```console - $ docker buildx rm --all-inactive - WARNING! This will remove all builders that are not in running state. Are you sure you want to continue? [y/N] y - ``` + ```console + $ docker buildx rm --all-inactive + WARNING! This will remove all builders that are not in running state. Are you sure you want to continue? [y/N] y + ``` - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). - ### Do not prompt for confirmation (--force) {#force} + ### Do not prompt for confirmation (--force) {#force} - Do not prompt for confirmation before removing inactive builders. + Do not prompt for confirmation before removing inactive builders. - ```console - $ docker buildx rm --all-inactive --force - ``` + ```console + $ docker buildx rm --all-inactive --force + ``` - ### Keep the buildkitd daemon running (--keep-daemon) {#keep-daemon} + ### Keep the buildkitd daemon running (--keep-daemon) {#keep-daemon} - Keep the buildkitd daemon running after the buildx context is removed. This is useful when you manage buildkitd daemons and buildx contexts independently. - Currently, only supported by the [`docker-container` and `kubernetes` drivers](buildx_create.md#driver). + Keep the buildkitd daemon running after the buildx context is removed. This is useful when you manage buildkitd daemons and buildx contexts independently. + Currently, only supported by the [`docker-container` and `kubernetes` drivers](buildx_create.md#driver). - ### Keep BuildKit state (--keep-state) {#keep-state} + ### Keep BuildKit state (--keep-state) {#keep-state} - Keep BuildKit state, so it can be reused by a new builder with the same name. - Currently, only supported by the [`docker-container` driver](buildx_create.md#driver). + Keep BuildKit state, so it can be reused by a new builder with the same name. + Currently, only supported by the [`docker-container` driver](buildx_create.md#driver). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_stop.yaml b/_data/buildx/docker_buildx_stop.yaml index a020c63289..6b64f81bbe 100644 --- a/_data/buildx/docker_buildx_stop.yaml +++ b/_data/buildx/docker_buildx_stop.yaml @@ -1,26 +1,26 @@ command: docker buildx stop short: Stop builder instance long: |- - Stops the specified or current builder. This will not prevent buildx build to - restart the builder. The implementation of stop depends on the driver. + Stops the specified or current builder. This will not prevent buildx build to + restart the builder. The implementation of stop depends on the driver. usage: docker buildx stop [NAME] pname: docker buildx plink: docker_buildx.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_uninstall.yaml b/_data/buildx/docker_buildx_uninstall.yaml index f223be2ba0..6a45c6c5be 100644 --- a/_data/buildx/docker_buildx_uninstall.yaml +++ b/_data/buildx/docker_buildx_uninstall.yaml @@ -5,15 +5,15 @@ usage: docker buildx uninstall pname: docker buildx plink: docker_buildx.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_use.yaml b/_data/buildx/docker_buildx_use.yaml index a68847cd2e..7e7fcf5a41 100644 --- a/_data/buildx/docker_buildx_use.yaml +++ b/_data/buildx/docker_buildx_use.yaml @@ -1,48 +1,48 @@ command: docker buildx use short: Set the current builder instance long: |- - Switches the current builder instance. Build commands invoked after this command - will run on a specified builder. Alternatively, a context name can be used to - switch to the default builder of that context. + Switches the current builder instance. Build commands invoked after this command + will run on a specified builder. Alternatively, a context name can be used to + switch to the default builder of that context. usage: docker buildx use [OPTIONS] NAME pname: docker buildx plink: docker_buildx.yaml options: -- option: default - value_type: bool - default_value: "false" - description: Set builder as default for current context - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false -- option: global - value_type: bool - default_value: "false" - description: Builder persists context changes - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: default + value_type: bool + default_value: "false" + description: Set builder as default for current context + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false + - option: global + value_type: bool + default_value: "false" + description: Builder persists context changes + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - details_url: '#builder' - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + details_url: '#builder' + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false examples: |- - ### Override the configured builder instance (--builder) {#builder} + ### Override the configured builder instance (--builder) {#builder} - Same as [`buildx --builder`](buildx.md#builder). + Same as [`buildx --builder`](buildx.md#builder). deprecated: false experimental: false experimentalcli: false diff --git a/_data/buildx/docker_buildx_version.yaml b/_data/buildx/docker_buildx_version.yaml index 09b6052e1d..2e2abfa487 100644 --- a/_data/buildx/docker_buildx_version.yaml +++ b/_data/buildx/docker_buildx_version.yaml @@ -1,25 +1,25 @@ command: docker buildx version short: Show buildx version information long: |- - View version information + View version information - ```console - $ docker buildx version - github.com/docker/buildx v0.5.1-docker 11057da37336192bfc57d81e02359ba7ba848e4a - ``` + ```console + $ docker buildx version + github.com/docker/buildx v0.5.1-docker 11057da37336192bfc57d81e02359ba7ba848e4a + ``` usage: docker buildx version pname: docker buildx plink: docker_buildx.yaml inherited_options: -- option: builder - value_type: string - description: Override the configured builder instance - deprecated: false - hidden: false - experimental: false - experimentalcli: false - kubernetes: false - swarm: false + - option: builder + value_type: string + description: Override the configured builder instance + deprecated: false + hidden: false + experimental: false + experimentalcli: false + kubernetes: false + swarm: false deprecated: false experimental: false experimentalcli: false