Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] Using $(command) in bash no longer works after updating to v2.40.0 #13282

@JulianVennen

Description

@JulianVennen

Description

The following compose.yaml which worked in v2.39.4 no longer works in v2.40.0:

services:
  test:
    build:
      dockerfile_inline: |
        FROM ubuntu:latest
        RUN ls $(pwd)

Running docker compose build throws the following error:

[+] Building 0.6s (6/6) FINISHED
 => [internal] load local bake definitions                                                                                                                                                                                                                             0.0s
 => => reading from stdin 505B                                                                                                                                                                                                                                         0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                                   0.0s
 => => transferring dockerfile: 72B                                                                                                                                                                                                                                    0.0s
 => [internal] load metadata for docker.io/library/ubuntu:latest                                                                                                                                                                                                       0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                        0.0s
 => CACHED [1/2] FROM docker.io/library/ubuntu:latest                                                                                                                                                                                                                  0.0s
 => ERROR [2/2] RUN ls $$(pwd)                                                                                                                                                                                                                                         0.5s
------
 > [2/2] RUN ls $$(pwd):
0.348 ls: cannot access '$/': No such file or directory
------
Dockerfile:2

--------------------

   1 |     FROM ubuntu:latest

   2 | >>> RUN ls \$$(pwd)

   3 |

--------------------

failed to solve: process "/bin/sh -c ls \\$$(pwd)" did not complete successfully: exit code: 2

Steps To Reproduce

  1. Copy the docker compose file from above
  2. Run docker compose build

Compose Version

docker compose version:

Docker Compose version v2.40.0


docker-compose is not installed

Docker Environment

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

Server:
 Containers: 643
  Running: 48
  Paused: 0
  Stopped: 595
 Images: 618
 Server Version: 28.5.1
 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:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.16.10-200.fc42.x86_64
 Operating System: Fedora Linux 42 (Workstation Edition)
 OSType: linux
 Architecture: x86_64
 CPUs: 20
 Total Memory: 62.46GiB
 Name: julian-xps-aternos-office
 ID: b7fc7b7b-8566-4cf6-8e9a-6fe544d0fd93
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

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