diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-06-09 13:27:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-09 13:27:11 -0400 |
commit | 874ca426eb51e2b1c9fd1d0c052de2e21f4afd2d (patch) | |
tree | 6bbd0f4dfe2240de05bc655cc36684bc98cb995f /pkg | |
parent | e5ef9fd5bc9ba959f134411e548e3820444f484c (diff) | |
parent | 5614c29ce1132ac8ee05687910248134d0f5c766 (diff) | |
download | podman-874ca426eb51e2b1c9fd1d0c052de2e21f4afd2d.tar.gz podman-874ca426eb51e2b1c9fd1d0c052de2e21f4afd2d.tar.bz2 podman-874ca426eb51e2b1c9fd1d0c052de2e21f4afd2d.zip |
Merge pull request #14549 from Luap99/compat-create
compat api: fix regressions from "Swagger refactor/cleanup"
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/containers_create.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkg/api/handlers/compat/containers_create.go b/pkg/api/handlers/compat/containers_create.go index b9b7f6708..67ec52047 100644 --- a/pkg/api/handlers/compat/containers_create.go +++ b/pkg/api/handlers/compat/containers_create.go @@ -261,8 +261,13 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.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 } @@ -278,6 +283,7 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C Network: nsmode, PublishPorts: specPorts, NetworkOptions: netOpts, + NoHosts: rtc.Containers.NoHosts, } // network names @@ -438,7 +444,7 @@ func cliOpts(cc handlers.CreateContainerConfig, rtc *config.Config) (*entities.C cliOpts.Volume = append(cliOpts.Volume, vol) // Extract the destination so we don't add duplicate mounts in // the volumes phase. - splitVol := strings.SplitN(vol, ":", 3) + splitVol := specgen.SplitVolumeString(vol) switch len(splitVol) { case 1: volDestinations[vol] = true |