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] v2.24.0 fails on "Circular reference" error on extended services with dependencies #11358

Closed
stekycz opened this issue Jan 16, 2024 · 4 comments

Comments

@stekycz
Copy link

stekycz commented Jan 16, 2024

Description

Docker Compose started failing recently on Circular reference error. It happens when I extended a service from another compose file which contains more service definitions (even those I am not suing in the specific place) and the new file states dependencies among services.

Steps To Reproduce

  1. Create a file docker-compose-base.yml
services:
  a:
    image: busybox
  b:
    image: busybox
  c:
    image: busybox
  1. Create file docker-compose.yml
services:
  a:
    extends:
      file: ./docker-compose-base.yml
      service: a
  b:
    extends:
      file: ./docker-compose-base.yml
      service: b
    depends_on:
      a:
        condition: service_started
  1. Run docker compose create
    Example error I would get
Circular reference:
    b in docker-compose.yml
    extends a in docker-compose-base.yml
    extends c in docker-compose-base.yml
    extends a in docker-compose.yml
    extends c in docker-compose-base.yml

Compose Version

2.24.0

Docker Environment

No response

Anything else?

No response

@asaurer
Copy link

asaurer commented Jan 17, 2024

Has anyone come up with a workaround (other than downgrading to 2.23)? Our CI is based on creating a compose config for our Docker Swarm by running docker compose -f ${DOCKER_COMPOSE_FILE} config --no-interpolate --output /tmp/docker-compose.swarm.yml which causes the same error as documented above.

@ndeloof
Copy link
Contributor

ndeloof commented Jan 17, 2024

Closing as a duplicate for #11343

Has anyone come up with a workaround

there's no workaround, a bug-fix release will come soon

Our CI is based on creating a compose config for our Docker Swarm

Why not just let docker stack parse your compose file ? Please note Swarm is not compliant with the compose specification, so combining compose and swarm can bring troubles

@ndeloof ndeloof closed this as completed Jan 17, 2024
@asaurer
Copy link

asaurer commented Jan 17, 2024

Why not just let docker stack parse your compose file ? Please note Swarm is not compliant with the compose specification, so combining compose and swarm can bring troubles

Exactly as you say: docker stack does not support the full syntax, but with docker compose config we generate a compose file that contains a file with the parts of the syntax we need (we only need the extends syntax to remove duplication in our config files).

@ndeloof
Copy link
Contributor

ndeloof commented Jan 17, 2024

right, docker stack indeed doesn't support extends :'(
anyway, compose config output might not be compatible with it as the file format evolves, and we won't maintain a second compose parser. See docker/cli#2527

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

No branches or pull requests

3 participants