server: correctly set hostname
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
0c1383fd30
commit
9ec518491f
6 changed files with 129 additions and 11 deletions
|
@ -818,18 +818,25 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
|||
options = []string{"ro"}
|
||||
}
|
||||
if sb.ResolvPath() != "" {
|
||||
// TODO: selinux
|
||||
// label.Relabel(sb.ResolvPath(), container.MountLabel, shared)
|
||||
|
||||
// bind mount the pod resolver file
|
||||
specgen.AddBindMount(sb.ResolvPath(), "/etc/resolv.conf", options)
|
||||
}
|
||||
|
||||
if sb.HostnamePath() != "" {
|
||||
// TODO: selinux
|
||||
|
||||
specgen.AddBindMount(sb.HostnamePath(), "/etc/hostname", options)
|
||||
}
|
||||
|
||||
// Bind mount /etc/hosts for host networking containers
|
||||
if hostNetwork(containerConfig) {
|
||||
specgen.AddBindMount("/etc/hosts", "/etc/hosts", options)
|
||||
}
|
||||
|
||||
if sb.Hostname() != "" {
|
||||
specgen.SetHostname(sb.Hostname())
|
||||
}
|
||||
specgen.SetHostname(sb.Hostname())
|
||||
|
||||
specgen.AddAnnotation(annotations.Name, containerName)
|
||||
specgen.AddAnnotation(annotations.ContainerID, containerID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue