summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-08-20 09:18:02 -0400
committerGitHub <noreply@github.com>2021-08-20 09:18:02 -0400
commit81798e488334f3a5f2ffbdd835cb8a1b4b630cd7 (patch)
treefcaf4259cf3523a4592f1778dedd262b1fdd217e /libpod
parent7d8650cce82e67fb998b9f8a89c66a51b4c98285 (diff)
parent7f3f792e283006ef24f69cf35aca15e2e467ca4c (diff)
downloadpodman-81798e488334f3a5f2ffbdd835cb8a1b4b630cd7.tar.gz
podman-81798e488334f3a5f2ffbdd835cb8a1b4b630cd7.tar.bz2
podman-81798e488334f3a5f2ffbdd835cb8a1b4b630cd7.zip
Merge pull request #11289 from Luap99/net-alias-id
Fix network aliases with network id
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime_ctr.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 059f56798..02bbb6981 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -246,6 +246,20 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
ctr.config.Networks = netNames
}
+ // https://github.com/containers/podman/issues/11285
+ // normalize the networks aliases to use network names and never ids
+ if len(ctr.config.NetworkAliases) > 0 {
+ netAliases := make(map[string][]string, len(ctr.config.NetworkAliases))
+ for nameOrID, aliases := range ctr.config.NetworkAliases {
+ netName, err := network.NormalizeName(r.config, nameOrID)
+ if err != nil {
+ return nil, err
+ }
+ netAliases[netName] = aliases
+ }
+ ctr.config.NetworkAliases = netAliases
+ }
+
// Inhibit shutdown until creation succeeds
shutdown.Inhibit()
defer shutdown.Uninhibit()