diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-04-23 09:22:44 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 09:22:44 -0400 |
commit | feac25f722284456fb3c065474f0e144a5e26982 (patch) | |
tree | 933451aa5c59e7ce9ac7e0cae55008695d2c7c5e /cmd/podman | |
parent | afdea0dccd06a907d04596375e056134dc4f5b33 (diff) | |
parent | ca4f6ec1dbdfd06f3d403eda70dbb2eff3824888 (diff) | |
download | podman-feac25f722284456fb3c065474f0e144a5e26982.tar.gz podman-feac25f722284456fb3c065474f0e144a5e26982.tar.bz2 podman-feac25f722284456fb3c065474f0e144a5e26982.zip |
Merge pull request #10122 from Luap99/fix-10110
Parse slirp4netns net options with compat api
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create_opts.go | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 040dc6570..983b9e5ca 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -252,21 +252,24 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup return nil, nil, err } - netNS := specgen.Namespace{ - NSMode: nsmode.NSMode, - Value: nsmode.Value, + var netOpts map[string][]string + parts := strings.SplitN(string(cc.HostConfig.NetworkMode), ":", 2) + if len(parts) > 1 { + netOpts = make(map[string][]string) + netOpts[parts[0]] = strings.Split(parts[1], ",") } // network // Note: we cannot emulate compat exactly here. we only allow specifics of networks to be // defined when there is only one network. netInfo := entities.NetOptions{ - AddHosts: cc.HostConfig.ExtraHosts, - DNSOptions: cc.HostConfig.DNSOptions, - DNSSearch: cc.HostConfig.DNSSearch, - DNSServers: dns, - Network: netNS, - PublishPorts: specPorts, + AddHosts: cc.HostConfig.ExtraHosts, + DNSOptions: cc.HostConfig.DNSOptions, + DNSSearch: cc.HostConfig.DNSSearch, + DNSServers: dns, + Network: nsmode, + PublishPorts: specPorts, + NetworkOptions: netOpts, } // network names |