docker-autocompose icon indicating copy to clipboard operation
docker-autocompose copied to clipboard

Add wildcard container selection and some code cleanup

Open d-EScape opened this issue 3 years ago • 2 comments

For lack of a better name I called the option --wildcard (-w). It will select all containers that have the specified text in their names. Use case: easily create stack files to import in portainer. Example: I have renamed my domotica related containers to dom.domoticz, dom.mqtt, dom.zwave etc. I can create 1 stack file by doing a 'autocompose.py -w dom.'

output has been checked with docker-compose config

d-EScape avatar Aug 20 '22 20:08 d-EScape

@d-EScape The wildcard addition is appreciated, though could you please review the conflicts here? I looked through to try and fix them myself, but not sure exactly how some of your "code cleanup" items will work with the most recent updates.

Red5d avatar Nov 30 '22 03:11 Red5d

Thanks @demon! The regex approach in #57 looks much more elegant. It does however also export all networks when filtering on --all (e.g. ./autocompose.py -f "someprefix.*" -a). That is because of lines 120-122.

if args.all:
        host_networks = generate_network_info()
        networks = host_networks

Is there any reason for exporting unused networks in that case? If so, can you change this to

 if args.all and not args.filter:
        host_networks = generate_network_info()
        networks = host_networks

d-EScape avatar Jul 31 '23 13:07 d-EScape