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] anchors should be available through includes #10912

Closed
shaunco opened this issue Aug 18, 2023 · 2 comments
Closed

[BUG] anchors should be available through includes #10912

shaunco opened this issue Aug 18, 2023 · 2 comments
Labels

Comments

@shaunco
Copy link

shaunco commented Aug 18, 2023

Description

Just like services, networks, and volumes, anchors should be referenceable from includes. Per the spec "Any volumes, networks, or other resources pulled in from the included Compose file can be used by the current Compose application for cross-service references."

With a shared.yml file like:

version: "3.8"

x-default-service:
  &default-service
  deploy:
    restart_policy:
      condition: on-failure
      delay: 10s
      max_attempts: 10
      window: 120s
  logging:
    driver: "json-file"
    options:
      max-size: "10m"
      max-file: "3"
  networks:
    - anchor-test

networks:
  anchor-test:

and a relying postgres.yml file like:

include:
  - ../shared/shared.yml

services:
  postgresql:
    <<: *default-service
    container_name: postgresql
    image: postgres:14

There is an error at the anchor reference line (<<: *default-service) that says: yaml: unknown anchor 'default-service' referenced

Steps To Reproduce

  1. Reproduce the two files above
  2. Run docker-compose -f postgres.yml config

Compose Version

`docker compose version`: `Docker Compose version v2.20.2-desktop.1`
`docker-compose version`: `Docker Compose version v2.20.2-desktop.1`

Docker Environment

No response

Anything else?

No response

@shaunco
Copy link
Author

shaunco commented Aug 19, 2023

@ndeloof - tagging you since you wrote the announcement blog post and might be able to quickly tell me I'm just doing something wrong.

@ndeloof
Copy link
Contributor

ndeloof commented Aug 19, 2023

include is not aa yaml feature, but a compose one: the included model is a set of resources your application can rely on, not some yaml entries you can use. each individual yaml file need to be valid and complete from a yaml point of view.

closing as "won't fix"

@ndeloof ndeloof closed this as completed Aug 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants