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

topic: extends, "Circular reference" when trying to extend more than 1 service #1343

Closed
brianclaridge-wf opened this issue Apr 24, 2015 · 7 comments
Labels

Comments

@brianclaridge-wf
Copy link

This may not be a bug and intentional, but it appears extends has a "Circular reference" problem when extending more than one level:

08:18:49 ~/workspaces$ cat docker-compose.yml && fig run bar bash
base:
    image: ubuntu:latest

foo:
    extends:
        file: docker-compose.yml
        service: base

bar:
    extends:
        file: docker-compose.yml
        service: foo
Circular reference:
  bar in ./docker-compose.yml
  extends bar in /Users/brianclaridge/workspaces/docker-compose.yml
08:18:56 ~/workspaces$

Curiously, fig run foo bash results in the same error. If I remove the bar service -- I can run foo again.

@dnephin
Copy link

dnephin commented Apr 24, 2015

I think if the service is in the current file, you can't use the name of the file. I don't remember if we left support for extending from the current file or not. Can you try without file: ... ?

@brianclaridge-wf
Copy link
Author

No sir, seems to require file:

08:32:32 ~/workspaces$ cat docker-compose.yml && fig run bar bash
base:
    image: ubuntu:latest

foo:
    extends:
        service: base

bar:
    extends:
        service: foo
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.main", line 31, in main
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 21, in sys_dispatch
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 27, in dispatch
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.docopt_command", line 24, in dispatch
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 57, in perform_command
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.cli.command", line 76, in get_project
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config", line 55, in load
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config", line 65, in from_dictionary
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config", line 88, in make_service_dict
  File "/compose/build/docker-compose/out00-PYZ.pyz/compose.config", line 100, in resolve_extends
KeyError: 'file'

@dnephin
Copy link

dnephin commented Apr 24, 2015

Ok, that sounds like a problem

@ghost
Copy link

ghost commented Apr 24, 2015

As a workaround, I can put the root service in it's own file:

08:54:31 ~/workspaces$ cat base.yml && cat docker-compose.yml && fig run bar bash
base:
    image: ubuntu:latest
foo:
    extends:
        file: base.yml
        service: base

bar:
    extends:
        file: docker-compose.yml
        service: foo
root@ece77849ab56:/# echo "success!"
success!

@aanand
Copy link

aanand commented May 1, 2015

Yep, this looks like a bug. We should fully support extending within the file (and we should allow you to omit the file key for that purpose).

@ferdynice
Copy link

Omitting the file key should be no-brainer when referencing the current file.

@aanand
Copy link

aanand commented Jul 16, 2015

Closed by #1632.

@aanand aanand closed this as completed Jul 16, 2015
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

4 participants