Unable to override image with multiple compose files
When trying to build and push an image defined by these compose files:
# docker-compose.yaml
services:
myservice:
build: .
image: myimage:dev
# docker-compose.myregistry.yaml
services:
myservice:
image: myregistry/myimage:latest
The tag from the second file doesn't override the first one.
Current output:
# docker buildx bake -f docker-compose.yaml -f docker-compose.myregistry.yaml --print
[+] Building 0.0s (0/0)
{
"target": {
"myservice": {
"context": ".",
"dockerfile": "Dockerfile",
"tags": [
"myimage:dev"
]
}
}
}
Expected output (can get this by adding build: {} to the second compose file):
# docker buildx bake -f docker-compose.yaml -f docker-compose.myregistry.yaml --print
[+] Building 0.0s (0/0)
{
"target": {
"myservice": {
"context": ".",
"dockerfile": "Dockerfile",
"tags": [
"myregistry/myimage:latest"
]
}
}
}
I'm using the moby-buildx 0.6.3+azure-1 package on Ubuntu 20.04.
I suspect this line is the culprit: https://github.com/docker/buildx/blob/06541ebd0f12adf99102b5d52ec26fea1022f495/bake/compose.go#L59
I also have the same issue!
Exact same situation, with a docker-compose.yaml and a docker-compose.override.yaml, the buildx bake command only picks up on the changes in the override if the build key is defined in the override. (even if it's empty, like in the example above)