diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 40a0c23..961cc8d 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -21,6 +21,11 @@ services: {% endif %} {% if container.networks is defined %} networks: +{% if container.networks is iterable and (container.networks is not string and container.networks is not mapping) %} +{% for network in container.networks %} + - {{ network }} +{% endfor %} +{% else %} {% for network, params in container.networks.items() %} {{ network }}: {% if params.aliases is defined %} @@ -31,6 +36,7 @@ services: {% endif %} {% endfor %} {% endif %} +{% endif %} {% if container.build is defined %} build: {{ container.build }} {% endif %} @@ -219,6 +225,7 @@ services: {% if networks is defined %} networks: {% for network in networks %} +{% if network.active %} {{ network.network_name }}: {% if network.external is defined %} external: {{ network.external }} @@ -226,5 +233,6 @@ networks: {% if network.driver is defined %} driver: {{ network.driver }} {% endif %} +{% endif %} {% endfor %} {% endif %}