Skip to content

[BUG] escaping dollar using $$ does not work when braces follow #13258

@fjf2002

Description

@fjf2002

Description

In the compose.yaml file, I was used to escaping $ with $$. However recently this seems to fail when braces follow.

Steps To Reproduce

compose.yaml:

services:
  foo:
    build:
      context: .
      args:
        foo: $${bar}

Dockerfile:

FROM debian
ARG foo
RUN echo foo is $foo

Executing

docker compose --progress=plain build

fails with

WARNING: The "bar" variable is not set. Defaulting to a blank string.
-.json:18,19-22: Unknown variable; There is no variable named "bar"., and 1 other diagnostic(s)

Please note that

  • removing the braces succeeds
  • using plain docker with docker build --build-arg 'foo=${bar}' --progress=plain . succeeds

Compose Version

Docker version 28.4.0, build d8eb465

Docker Environment

Client: Docker Engine - Community
 Version:    28.4.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.29.0
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.39.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 33
  Running: 3
  Paused: 0
  Stopped: 30
 Images: 336
 Server Version: 28.4.0
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 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
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b98a3aace656320842a23f4a392a33f46af97866
 runc version: v1.3.0-0-g4ca628d1
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.14.0-29-generic
 Operating System: Ubuntu 25.04
 OSType: linux
 Architecture: x86_64
 CPUs: 12
 Total Memory: 28.87GiB
 Name: [obfuscated]
 ID: a1831f45-6602-43f9-8b48-7fa9ae79fbe8
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: [obfuscated]
 HTTPS Proxy: [obfuscated]
 No Proxy: [obfuscated]
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions