summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-12 18:20:17 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-13 15:43:47 +0200
commit970c8d4724d0a3d24be5736e09dd37c8644c64b1 (patch)
tree85fb2bd6fc51692092aba9aa9f8300581016b2c7 /cmd/podman
parentf6ce14b066ad57a86642f22c15ac42020fc0f660 (diff)
downloadpodman-970c8d4724d0a3d24be5736e09dd37c8644c64b1.tar.gz
podman-970c8d4724d0a3d24be5736e09dd37c8644c64b1.tar.bz2
podman-970c8d4724d0a3d24be5736e09dd37c8644c64b1.zip
compat api: use network mode bridge as default
For better docker compatibility we should use the bridge network mode as default for rootless. This was already done previously but commit 535818414c2a introduced this regression in v4.0. Since the apiv2 test are only run rootful we cannot catch this problem in CI. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/common/create_opts.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go
index 39146f918..7b7626040 100644
--- a/cmd/podman/common/create_opts.go
+++ b/cmd/podman/common/create_opts.go
@@ -164,8 +164,13 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, rtc *c
}
}
- // netMode
- nsmode, networks, netOpts, err := specgen.ParseNetworkFlag([]string{string(cc.HostConfig.NetworkMode)})
+ // special case for NetworkMode, the podman default is slirp4netns for
+ // rootless but for better docker compat we want bridge.
+ netmode := string(cc.HostConfig.NetworkMode)
+ if netmode == "" || netmode == "default" {
+ netmode = "bridge"
+ }
+ nsmode, networks, netOpts, err := specgen.ParseNetworkFlag([]string{netmode})
if err != nil {
return nil, nil, err
}