Browse Source

Merge pull request #17424 from coolljt0725/fix_inspect_gateway_value

Fix docker inspect display odd gateway value for none network mode
David Calavera 9 years ago
parent
commit
54d42f4a10
1 changed files with 3 additions and 1 deletions
  1. 3 1
      daemon/container_unix.go

+ 3 - 1
daemon/container_unix.go

@@ -714,7 +714,9 @@ func (container *Container) updateJoinInfo(n libnetwork.Network, ep libnetwork.E
 		// It is not an error to get an empty endpoint info
 		return nil
 	}
-	container.NetworkSettings.Networks[n.Name()].Gateway = epInfo.Gateway().String()
+	if epInfo.Gateway() != nil {
+		container.NetworkSettings.Networks[n.Name()].Gateway = epInfo.Gateway().String()
+	}
 	if epInfo.GatewayIPv6().To16() != nil {
 		container.NetworkSettings.Networks[n.Name()].IPv6Gateway = epInfo.GatewayIPv6().String()
 	}