Ensure that network_mode and networks are not present at the same time

See
https://docs.docker.com/reference/compose-file/services/#network_mode

Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
Povilas Kanapickas
2024-12-18 19:59:23 +02:00
parent a023dc145b
commit 2891be01d7
3 changed files with 17 additions and 0 deletions

View File

@@ -880,6 +880,12 @@ async def assert_cnt_nets(compose, cnt):
def get_net_args_from_network_mode(compose, cnt):
net_args = []
net = cnt.get("network_mode")
service_name = cnt["service_name"]
if "networks" in cnt:
raise ValueError(
f"networks and network_mode must not be present in the same service [{service_name}]"
)
is_bridge = False
if net == "none":