-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
Description
Description
Not sure if I should report this here or at docker/buildx, please move this issue if this is not related to docker compose.
I have the following Docker Compose file:
name: dockerfile-inline-bake-bug
services:
whoami:
build:
args:
VERSION: latest
dockerfile_inline: |
ARG VERSION=latest
FROM traefik/whoami:$${VERSION}
COPY --from=ghcr.io/tarampampam/curl /bin/curl /curl
HEALTHCHECK --interval=10s --start-period=2s CMD ["/curl", "--fail", "http://127.0.0.1:80/health"]
restart: always
ports:
- "8080:80"
When I start it up with docker compose up --build, everything works normally and the way it should.
However, since Compose now recommends using Buildx Bake to delegate builds, I tried setting COMPOSE_BAKE to true, like this: COMPOSE_BAKE=true docker compose up --build.
Unfortunately, this does not seem to work at the moment with my Docker Compose file.
I get the following error message (with --debug mode):
DEBU[0000] bake build config:
{
"group": {
"default": {
"targets": [
"whoami"
]
}
},
"target": {
"whoami": {
"context": "/tmp/docker-bake-bug",
"dockerfile-inline": "ARG VERSION=latest\nFROM traefik/whoami:${VERSION}\nCOPY --from=ghcr.io/tarampampam/curl /bin/curl /curl\nHEALTHCHECK --interval=10s --start-period=2s CMD [\"/curl\", \"--fail\", \"http://127.0.0.1:80/health\"]\n",
"args": {
"VERSION": "latest"
},
"tags": [
"dockerfile-inline-bake-bug-whoami"
],
"output": [
"type=docker,load=true,push=false"
]
}
}
}
DEBU[0000] Executing bake with args: [bake --file - --progress rawjson --metadata-file /tmp/compose941831155 --allow fs.read=/tmp/docker-bake-bug]
[+] Building 0.0s (1/1) FINISHED
=> [internal] load local bake definitions 0.0s
=> => reading from stdin 621B 0.0s
DEBU[0000] otel error error="<nil>"
DEBU[0000] otel error error="<nil>"
-.json:13,23-30: Unknown variable; There is no variable named "VERSION"., and 1 other diagnostic(s)
Steps To Reproduce
- Create a file named
compose.yamlwith the following content:name: dockerfile-inline-bake-bug services: whoami: build: args: VERSION: latest dockerfile_inline: | ARG VERSION=latest FROM traefik/whoami:$${VERSION} COPY --from=ghcr.io/tarampampam/curl /bin/curl /curl HEALTHCHECK --interval=10s --start-period=2s CMD ["/curl", "--fail", "http://127.0.0.1:80/health"] restart: always ports: - "8080:80"
- Run
COMPOSE_BAKE=true docker --debug compose up --build - An error occurs
Compose Version
Docker Compose version 2.34.0
Docker Environment
Client:
Version: 28.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.21.3
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 2.34.0
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 13
Running: 0
Paused: 0
Stopped: 13
Images: 92
Server Version: 28.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: local
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 1a43cb6a1035441f9aca8f5666a9b3ef9e70ab20.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.13.7-arch1-1
Operating System: EndeavourOS
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51GiB
Name: hostname
ID: 271ff1f7-e709-42c4-a1cf-2659a5547a28
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: username
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Anything else?
Other than this, really loving Buildx Bake mode so far!