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

Broken environment variables substitution in command: directive after v2.8.0 #9697

Closed
metajiji opened this issue Aug 1, 2022 · 1 comment · Fixed by compose-spec/compose-go#296

Comments

@metajiji
Copy link

metajiji commented Aug 1, 2022

Description

Steps to reproduce the issue:

  1. Create docker-compose.yml with variable substitution in command: directive
    version: "3"
    services:
      test:
        image: busybox
        command: >-
          --bar=${BAR:-default}
  2. Run docker-compose config or docker-compose up

Describe the results you received:

Wrong result docker-compose config for v2.8.0 version

$ BAR=test docker-compose_v2.8.0 config
name: test
services:
  test:
    command:
    - --bar=default
    image: busybox
    networks:
      default: null
networks:
  default:
    name: test-default

Variable substitution is ignored for

        command: >-
          --bar=${BAR:-default}

Describe the results you expected:

Right result docker-compose config for v2.7.0 version

$ BAR=test docker-compose_v2.7.0 config
name: test
services:
  test:
    command:
    - --bar=test
    image: busybox
    networks:
      default: null
networks:
  default:
    name: test_default

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker compose version:

Docker Compose version v2.8.0

Output of docker info:

Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 5
  Running: 4
  Paused: 0
  Stopped: 1
 Images: 5
 Server Version: 20.10.10
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 5b46e404f6b9f661a205e28d59c982d3634148f8
 runc version: v1.0.2-0-g52b36a2d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.17.5-300.fc36.x86_64
 Operating System: Fedora Linux 36 (Server Edition)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 1.925GiB
 Name: wg-nl
 ID: 3BQL:OSW6:LZI2:ADGC:V3BI:RNIP:YH7O:IDXH:PBLI:GAPX:GZNB:A7PL
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

Additional environment details:

@ulyssessouza
Copy link
Contributor

Hello @metajiji. A fix for that issue is already on going. We should release a patch version ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants