Merge pull request #1002 from nerilex/main

Add `--network=none` if `network_mode: none` is set
This commit is contained in:
Povilas Kanapickas 2024-07-17 05:19:19 +03:00 committed by GitHub
commit b6eadd56b1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 1 deletions

View File

@ -0,0 +1 @@
Fix support for `network_mode: none`.

View File

@ -876,6 +876,7 @@ def get_net_args(compose, cnt):
if net:
if net == "none":
is_bridge = False
net_args.append("--network=none")
elif net == "host":
net_args.append(f"--network={net}")
elif net.startswith("slirp4netns"): # Note: podman-specific network mode

View File

@ -257,7 +257,7 @@ class TestGetNetArgs(unittest.TestCase):
@parameterized.expand([
("bridge", ["--network=bridge", f"--network-alias={SERVICE_NAME}"]),
("host", ["--network=host"]),
("none", []),
("none", ["--network=none"]),
("slirp4netns", ["--network=slirp4netns"]),
("slirp4netns:cidr=10.42.0.0/24", ["--network=slirp4netns:cidr=10.42.0.0/24"]),
("private", ["--network=private"]),