forked from extern/podman-compose
FIXES #507: respecte mac_address
This commit is contained in:
parent
13c8981c6d
commit
9eda56caf9
@ -30,7 +30,7 @@ app.add_routes(routes)
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
web.run_app(app)
|
web.run_app(app, port=8080)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
@ -738,19 +738,26 @@ def assert_cnt_nets(compose, cnt):
|
|||||||
|
|
||||||
def get_net_args(compose, cnt):
|
def get_net_args(compose, cnt):
|
||||||
service_name = cnt["service_name"]
|
service_name = cnt["service_name"]
|
||||||
|
net_args = []
|
||||||
|
mac_address = cnt.get("mac_address", None)
|
||||||
|
if mac_address:
|
||||||
|
net_args.extend(["--mac_address", mac_address])
|
||||||
net = cnt.get("network_mode", None)
|
net = cnt.get("network_mode", None)
|
||||||
if net:
|
if net:
|
||||||
if net == "host":
|
if net == "host":
|
||||||
return ["--network", net]
|
net_args.extend(["--network", net])
|
||||||
if net.startswith("slirp4netns:"):
|
elif net.startswith("slirp4netns:"):
|
||||||
return ["--network", net]
|
net_args.extend(["--network", net])
|
||||||
if net.startswith("service:"):
|
elif net.startswith("service:"):
|
||||||
other_srv = net.split(":", 1)[1].strip()
|
other_srv = net.split(":", 1)[1].strip()
|
||||||
other_cnt = compose.container_names_by_service[other_srv][0]
|
other_cnt = compose.container_names_by_service[other_srv][0]
|
||||||
return ["--network", f"container:{other_cnt}"]
|
net_args.extend(["--network", f"container:{other_cnt}"])
|
||||||
if net.startswith("container:"):
|
elif net.startswith("container:"):
|
||||||
other_cnt = net.split(":", 1)[1].strip()
|
other_cnt = net.split(":", 1)[1].strip()
|
||||||
return ["--network", f"container:{other_cnt}"]
|
net_args.extend(["--network", f"container:{other_cnt}"])
|
||||||
|
else:
|
||||||
|
print(f"unknown network_mode [{net}]")
|
||||||
|
exit(1)
|
||||||
proj_name = compose.project_name
|
proj_name = compose.project_name
|
||||||
default_net = compose.default_net
|
default_net = compose.default_net
|
||||||
nets = compose.networks
|
nets = compose.networks
|
||||||
@ -779,7 +786,7 @@ def get_net_args(compose, cnt):
|
|||||||
)
|
)
|
||||||
net_names.add(net_name)
|
net_names.add(net_name)
|
||||||
net_names_str = ",".join(net_names)
|
net_names_str = ",".join(net_names)
|
||||||
net_args = ["--net", net_names_str, "--network-alias", ",".join(aliases)]
|
net_args.extend(["--net", net_names_str, "--network-alias", ",".join(aliases)])
|
||||||
if ip:
|
if ip:
|
||||||
net_args.append(f"--ip={ip}")
|
net_args.append(f"--ip={ip}")
|
||||||
return net_args
|
return net_args
|
||||||
|
Loading…
Reference in New Issue
Block a user