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] compose config ignores the service to show the config for when given as argument #11608

Closed
luciangabor opened this issue Mar 12, 2024 · 4 comments · Fixed by compose-spec/compose-go#607

Comments

@luciangabor
Copy link

$ docker compose -f - config service1 <<-'EOF'
name: select-service
services:
  service1:
    image: service1
  service2:
    image: service2
EOF
name: select-service
networks:
  default:
    name: select-service_default
services:
  service1:
    image: service1
    networks:
      default: null
  service2:
    image: service2
    networks:
      default: null

#11587 (comment)

@ndeloof
Copy link
Contributor

ndeloof commented Mar 13, 2024

fixed by #11604

@luciangabor
Copy link
Author

This is not really fixed - it works if services don't have profiles but when profiles are involved the behavior is strange:

# with my own build of what's now in main
$ docker-compose-linux-x86_64 version
Docker Compose version 5a1ba0e

# and this compose.yaml
$ cat compose.yaml 
services:
  s1:
    profiles:
      - p1
    image: image

  s2:
    profiles:
      - p2
    image: image

# this shouldn't "work"
$ docker-compose-linux-x86_64 config s1
name: config
services:
  s1:
    profiles:
      - p1
    image: image
    networks:
      default: null
networks:
  default:
    name: config_default

# this definitely shouldn't work
$ docker-compose-linux-x86_64 --profile p2 config s1
name: config
services:
  s1:
    profiles:
      - p1
    image: image
    networks:
      default: null
networks:
  default:
    name: config_default

# this doesn't work, but it should
$ docker-compose-linux-x86_64 --profile '*' config s1
no such service: s1

@ndeloof
Copy link
Contributor

ndeloof commented Mar 13, 2024

Compose commands, when ran with an explicit service name, automagically enable the target service even it's not active by profile.
You last example definitely demonstrates a bug

@luciangabor
Copy link
Author

oh uau, that's actually true - this thing is definitely a sea creature - nothing is plane/plain :D (is the name of the mascot chosen?)

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

Successfully merging a pull request may close this issue.

2 participants