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

Include multiple docker-compose.yml in chart #43

Open
nicolailang opened this issue Aug 26, 2018 · 6 comments
Open

Include multiple docker-compose.yml in chart #43

nicolailang opened this issue Aug 26, 2018 · 6 comments
Milestone

Comments

@nicolailang
Copy link

A really nice tool - I like it a lot.

I'm not sure if it is hard to do but I could use if it would include multiple docker-compose files. I have a complex setup where i use docker-compose-letsencrypt-nginx-proxy-companion so I have a shared network between several dockers. Would be nice to do a system-wide drawing :)

@agravelot
Copy link

agravelot commented Apr 19, 2020

Merge multiple yml files together, then run docker-compose-viz on newer generated yml.

docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.local-dev.yml config > tmp.yml
docker run --rm -it --name dcv -v $(pwd):/input pmsipilot/docker-compose-viz render -m image tmp.yml --force
rm  tmp.yml

@jubianchi jubianchi added this to the 1.2.0 milestone Jul 23, 2020
@jubianchi
Copy link
Member

The more I read this issue, the more I think the best solution is what @agravelot explained.

Merging docker-compose.yml files could potentially be a hard task. the only way to guarantee dcvdoes this the exact same way docker-compose does it is to let it do the merge.

What do you think?

@phantomwhale
Copy link

Just wanted to chip in that I tried the technique above (two docker-compose files - run through docker-compose config - chart with the output) and hit a few issues, likely due to the docker-compose config output creating structures that the code could not recognise.

Mostly this was in port mappings. E.g.

    ports:
      - "49998:443/tcp"

Would get written out as:

    ports:
    - protocol: tcp
      published: 49965
      target: 443

Which then errors on processing:

Warning: explode() expects parameter 2 to be string, array given in /dcv/src/functions.php on line 538

Warning: count(): Parameter must be an array or an object that implements Countable in /dcv/src/functions.php on line 540

I also found it added a condition: service_started to every dependency, which then gets rendered on every single dependency line in the output image, which clutters the diagram up.

Think I'll end up just appending my files, because there is no actual "overriding" of config happening between them, but suspect dcv will need a little more work to support the slightly more exploded output format of docker-compose config

@weihao
Copy link

weihao commented Oct 26, 2021

merging in two docker-compose files does not work when two docker-compose files are placed in two different directories and when they are using the absolute path in volumes.

@theitalianz
Copy link

I'm having the same issue with ports, I opened #62, it should help.

@jubianchi
Copy link
Member

Hi all!

I'm currently working on this and a preview is available in the rewrite-v2 branch.

You can now use dcv like that:

bin/dcv render docker-compose.yml docker-compose.local.yml docker-compose.local-dev.yml

dcv will try its best to merge the files and render the configuration. There might still be some differences between how docker-compose merges configurations and how dcv does it: feel free to report such differences.

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

6 participants