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

Compose V2 does not output multiline environment variable error correctly #9680

Closed
MartinsSmirnovs opened this issue Jul 27, 2022 · 1 comment
Assignees

Comments

@MartinsSmirnovs
Copy link

MartinsSmirnovs commented Jul 27, 2022

Description

For given docker-compose.yml, if we have not set WHOAMI environment variable, Compose V2 will not output multiline error as Compose V1 does.

x-whoami: &whoami |-
    ${WHOAMI?
    Hint:
    Set WHOAMI environment variable
    }


services:
  foo:
    image: alpine
    environment:
        WHOAMI: *whoami

Steps to reproduce the issue:

  1. Create docker-compose.yml with given contents.
  2. Observe different docker-compose up outputs for Compose V1 and V2.

Results for Compose V1

$ docker-compose up
ERROR: Missing mandatory value for "environment" option interpolating {'WHOAMI': '${WHOAMI?\nHint:\nSet WHOAMI environment variable\n}'} in service "foo":
Hint:
Set WHOAMI environment variable

$

Results for Compose V2

$ docker-compose up
invalid interpolation format for x-whoami: "required variable WHOAMI is missing a value: \nHint:\nSet WHOAMI environment variable\n". You may need to escape any $ with another $
$

Expected results:
Compose V2 should output multiline error string as Compose V1 does.

Output of docker-compose --version:
Compose --version output with executable changing in between:

$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c
$ docker-compose --version
Docker Compose version v2.6.0
$

Output of docker info:

$ docker info
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc., v0.8.2)
  compose: Docker Compose (Docker Inc., v2.6.0)
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
  scan: Docker Scan (Docker Inc., v0.17.0)

Server:
 Containers: 2
  Running: 1
  Paused: 0
  Stopped: 1
 Images: 19
 Server Version: 20.10.16
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 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: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
 runc version: v1.1.1-0-g52de29d
 init version: de40ad0
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 5.10.16.3-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 9.728GiB
 Name: docker-desktop
 ID: LIV4:465T:SSGL:P2Q6:7Y6O:UIQR:3TXQ:UJAR:H43B:KH7B:7SKQ:5LIF
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5000
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support
$
@ulyssessouza
Copy link
Contributor

Closed by compose-spec/compose-go#292

@ulyssessouza ulyssessouza self-assigned this Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants