add hostname to network alias

We use the name as alias but using the hostname makes also sense and
this is what docker does. We have to keep the short id as well for
docker compat.

While adding some tests I removed some duplicated tests that were
executed twice for nv for no reason.

Fixes #17370

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2023-07-11 15:38:24 +02:00
parent b6ec2127b8
commit f1c68b79eb
4 changed files with 19 additions and 54 deletions

View File

@ -282,8 +282,7 @@ func (r *Runtime) setupContainer(ctx context.Context, ctr *Container) (_ *Contai
return nil, errors.New("failed to find free network interface name")
}
}
// always add the short id as alias for docker compat
opts.Aliases = append(opts.Aliases, ctr.config.ID[:12])
opts.Aliases = append(opts.Aliases, getExtraNetworkAliases(ctr)...)
normalizeNetworks[netName] = opts
}