Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bake does not merge compose services/<service>/build/x-bake setting with serivice extensions #4898

Open
cybercode opened this issue May 2, 2024 · 0 comments

Comments

@cybercode
Copy link

cybercode commented May 2, 2024

In latest update to docker desktop, v 4.29.0 (145265), (other version info below). the x-bake key in the base compose file is not merged with the contents of the extension file if the key exists or is set. This is only seems to be true for the x-bake key. This worked at least as recently as docker desktop 4.24 (don't have any other versions available locally)

Below are examples of the compose.yml file and the output of docker builds bake --print:

extend.yml

services:
  extend:
    build:
      labels:
        - com.example.two=2
      x-bake:
        ssh: default
        platforms: linux/amd64

No x-bake key in base file

compose.yml

services:
  app:
    image: alpine:latest
    extends:
      file: ./extend.yml
      service: extend
    build:
      labels:
        - com.example.one=1

output

{
  "group": {
    "default": {
      "targets": [
        "app"
      ]
    }
  },
{
  "group": {
    "default": {
      "targets": [
        "app"
      ]
    }
  },
  "target": {
    "app": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "labels": {
        "com.example.one": "1",
        "com.example.two": "2"
      },
      "tags": [
        "alpine:latest"
      ],
      "ssh": [
        "default"
      ],
      "platforms": [
        "linux/amd64"
      ]
    }
  }
}

with x-bake key in base file

compose.yml

services:
  app:
    image: alpine:latest
    extends:
      file: ./extend.yml
      service: extend
    build:
      labels:
        - com.example.one=1
      x-bake:

output

{
  "group": {
    "default": {
      "targets": [
        "app"
      ]
    }
  },
  "target": {
    "app": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "labels": {
        "com.example.one": "1",
        "com.example.two": "2"
      },
      "tags": [
        "alpine:latest"
      ]
    }
  }
}

Environment

$ docker version
Client:
 Cloud integration: v1.0.35+desktop.13
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:14:46 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.29.0 (145265)
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:02 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

$ docker buildx version
github.com/docker/buildx v0.13.1-desktop.1 2368b2ee41873b948cb607251cec573ed00f00f9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant