Skip to content

--load and other cli flags regarding output behave different than expected #3230

@tg-freigmbh

Description

@tg-freigmbh

Contributing guidelines

I've found a bug and checked that ...

  • ... the documentation does not mention anything about my problem
  • ... there are no open or closed issues that are related to my problem

Description

docker buildx bake --help
--load Shorthand for "--set=*.output=type=docker"

The help would indicate that its just a shorthand and nothing magical is going on

Expected behaviour

It just a shorthand and nothing magical is going on

Actual behaviour

docker buildx bake --load --print
[+] Building 0.0s (1/1) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load local bake definitions                                                                                                                                                                                                                                                                         0.0s 
 => => reading docker-bake.hcl 59B / 59B                                                                                                                                                                                                                                                                           0.0s 
{
  "group": {
    "default": {
      "targets": [
        "default"
      ]
    }
  },
  "target": {
    "default": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        {
          "dest": "hi.tar",
          "type": "tar"
        }
      ]
    }
  }
}

It is not possible to override the ouptut using --load

docker buildx bake  "--set=*.output=type=docker"  --print 
[+] Building 0.0s (1/1) FINISHED                                                                                                                                                                                                                                                                                        
 => [internal] load local bake definitions                                                                                                                                                                                                                                                                         0.0s 
 => => reading docker-bake.hcl 59B / 59B                                                                                                                                                                                                                                                                           0.0s 
{
  "group": {
    "default": {
      "targets": [
        "default"
      ]
    }
  },
  "target": {
    "default": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "output": [
        {
          "type": "docker"
        }
      ]
    }
  }
}

Using the longhand syntax its suddenly possible.

If it is intended that --load cant override the values speciefied in the buildfile this should be clearly documented, because this is highly confusing.
I think it would be preferable if --load would behave exactly the same as the --set syntax

Buildx version

github.com/docker/buildx v0.22.0-desktop.1 b45d7a53aa26a5e76aae051acdb15775c0e178da

Docker info


Builders list

NAME/NODE           DRIVER/ENDPOINT     STATUS    BUILDKIT   PLATFORMS
default             docker
 \_ default          \_ default         running   v0.20.2    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)
desktop-linux*      docker
 \_ desktop-linux    \_ desktop-linux   running   v0.20.2    linux/amd64 (+3), linux/arm64, linux/arm (+2), linux/ppc64le, (2 more)

Configuration

target "default" {
output= ["type=tar,dest=hi.tar"]

}

Build logs


Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions