Skip to content

docs: bake: no-cache example is wrong #23202

@MalteMagnussen

Description

@MalteMagnussen

Is this a docs issue?

  • My issue is about the documentation content or website

Type of issue

Information is incorrect

Description

The example shows the following: https://docs.docker.com/build/bake/reference/#targetno-cache

[target.no-cache](https://docs.docker.com/build/bake/reference/#targetno-cache)

Don't use cache when building the image. This is the same as the --no-cache flag for docker build.

target "default" {
  no-cache = 1
}

And if I hover the "no-cache" string in visual studio code it says: no-cache optional, number

Image

But the 1 has a red underline. If I hover that, I get:

Unsuitable value type (Unsuitable value: bool required)Docker DX (docker-language-server)
Image

Location

https://docs.docker.com/build/bake/reference/

Suggestion

[target.no-cache](https://docs.docker.com/build/bake/reference/#targetno-cache)

Don't use cache when building the image. This is the same as the --no-cache flag for docker build.

target "default" {
  no-cache = true
}

It seems like there is a clash with the Visual code extension Docker DX (docker-language-server)

more info

$ docker buildx bake ansible
[+] Building 0.0s (1/1) FINISHED                                                       docker-container:docker-container
 => [internal] load local bake definitions                                                                          0.0s
 => => reading docker-compose.yml 721B / 721B                                                                       0.0s
 => => reading docker-bake.hcl 2.15kB / 2.15kB                                                                      0.0s
docker-bake.hcl:89
--------------------
  87 |     
  88 |     target "ansible" {
  89 | >>>   no-cache = 1
  90 |       target = "ansible"
  91 |       output = [{type="cacheonly"}]
--------------------
ERROR: docker-bake.hcl:89,14-15: Unsuitable value type; Unsuitable value: bool required

If I use "true" instead of "1", then it works just fine. I also think "true" makes more sense than "1".

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/buildRelates to Dockerfiles or docker build command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions