Red5d / docker-autocompose

Generate a docker-compose yaml definition from a running container
1.76k stars 197 forks source link

Add gather info about all networks in the system. #53

Closed yeyeto2788 closed 1 year ago

yeyeto2788 commented 1 year ago

Hey there!

This PR adds the functionality to gather a little bit more information about the networks when the --all argument is passed to the command and should take care of issues:

2sh33ts commented 1 year ago

I just tried running the updated autocompose.py script and I am getting the same output:

root@2sh33ts:/mnt/user/scripts# sudo python3 autocompose.py qbittorrent Traceback (most recent call last): File "/mnt/user/scripts/autocompose.py", line 314, in main() File "/mnt/user/scripts/autocompose.py", line 91, in main cfile, c_networks, c_volumes = generate(cname, createvolumes=args.createvolumes) File "/mnt/user/scripts/autocompose.py", line 213, in generate assumed_default_network = list(cattrs.get("NetworkSettings", {}).get("Networks", {}).keys())[0] IndexError: list index out of range

Thoughts?

yeyeto2788 commented 1 year ago

Hey @2sh33ts,

I have applied some changes to the code in order to mitigate that issue at https://github.com/Red5d/docker-autocompose/pull/54

I hope the issue is gone now. If the error still persists I'll probably need more information by issuing a docker inspect qbittorrent on your end. This might be caused by not having any network attached to the container perhaps?

Best.