From e57d2f987d03d48a5b8cf3ee127551feb55434ce Mon Sep 17 00:00:00 2001 From: Andrei Ushakov Date: Sat, 30 Apr 2016 20:47:24 -0700 Subject: [PATCH] don't add /etc/hosts record if ip is empty (issue #1146) Signed-off-by: Andrei Ushakov --- libnetwork/sandbox_dns_unix.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libnetwork/sandbox_dns_unix.go b/libnetwork/sandbox_dns_unix.go index ac1f53c76e..8d59e3d66a 100644 --- a/libnetwork/sandbox_dns_unix.go +++ b/libnetwork/sandbox_dns_unix.go @@ -90,6 +90,10 @@ func (sb *sandbox) buildHostsFile() error { func (sb *sandbox) updateHostsFile(ifaceIP string) error { var mhost string + if ifaceIP == "" { + return nil + } + if sb.config.originHostsPath != "" { return nil }