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

[BUG] config --variables lists broken variable names #11785

Closed
jonasgeiler opened this issue May 2, 2024 · 0 comments · Fixed by compose-spec/compose-go#626
Closed

[BUG] config --variables lists broken variable names #11785

jonasgeiler opened this issue May 2, 2024 · 0 comments · Fixed by compose-spec/compose-go#626

Comments

@jonasgeiler
Copy link

jonasgeiler commented May 2, 2024

Description

I'm not sure whether to report this here or at compose-spec/compose-go.

I came across a strange issue where running docker compose config --variables lists weird and incorrect variable names like so:

NAME                             REQUIRED            DEFAULT VALUE       ALTERNATE VALUE
SUBDOMAIN:-redis}.${ROOTDOMAIN   true

Docker compose seems to wrongly parse the variable interpolations and match the furthest : instead of the closest : for the variable name.
When running docker compose config the variable interpolations work correctly and the way they should, so this is only an issue when listing the variables using --variables.

Steps To Reproduce

  1. Create a docker-compose.yml file with the following content:
    services:
      redis:
        image: "redis:alpine"
        domainname: ${SUBDOMAIN:-redis}.${ROOTDOMAIN:?}
  2. Run docker compose config --variables
  3. This is the output:
    NAME                             REQUIRED            DEFAULT VALUE       ALTERNATE VALUE
    SUBDOMAIN:-redis}.${ROOTDOMAIN   true
    
    And this is the output I would EXPECT:
    NAME                             REQUIRED            DEFAULT VALUE       ALTERNATE VALUE
    SUBDOMAIN                        false               redis
    ROOTDOMAIN                       true
    

Compose Version

Docker Compose version 2.27.0

Docker Environment

Client:
 Version:    26.1.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.14.0
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.27.0
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 1
  Running: 0
  Paused: 0
  Stopped: 1
 Images: 10
 Server Version: 26.1.0
 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: 83031836b2cf55637d7abf847b17134c51b38e53.m
 runc version:
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.8.7-arch1-2
 Operating System: EndeavourOS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.39GiB
 Name: jonas-laptop
 ID: 271ff1f7-e709-42c4-a1cf-2659a5547a28
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Username: jonasgeiler
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

@jonasgeiler jonasgeiler changed the title [BUG] config --variables lists invalid variable names [BUG] config --variables lists broken variable names May 2, 2024
@ndeloof ndeloof self-assigned this May 3, 2024
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.

2 participants