1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Check supplied hostname before using it.

Docker-DCO-1.1-Signed-off-by: Rohit Jnagal <jnagal@google.com> (github: rjnagal)
Upstream-commit: 412324cfbe9b5e256d9af31b21e6ae142d39612c
Component: engine
This commit is contained in:
Rohit Jnagal
2014-05-05 18:12:25 +00:00
parent f9d5620b8d
commit d6e1c1cb2b

View File

@@ -65,8 +65,10 @@ func Init(container *libcontainer.Container, uncleanRootfs, consolePath string,
if err := mount.InitializeMountNamespace(rootfs, consolePath, container); err != nil {
return fmt.Errorf("setup mount namespace %s", err)
}
if err := system.Sethostname(container.Hostname); err != nil {
return fmt.Errorf("sethostname %s", err)
if container.Hostname != "" {
if err := system.Sethostname(container.Hostname); err != nil {
return fmt.Errorf("sethostname %s", err)
}
}
if err := FinalizeNamespace(container); err != nil {
return fmt.Errorf("finalize namespace %s", err)