Fix docker inspect display odd gateway value for none network mode

Signed-off-by: Lei Jitang <leijitang@huawei.com>
(cherry picked from commit 7fa601adc7858606630dec5b037e60b8955e716d)
This commit is contained in:
Lei Jitang
2015-10-30 20:27:44 -04:00
committed by Tibor Vass
parent 22cf3df4c0
commit 9335cf9d29
+3 -1
View File
@@ -713,7 +713,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()
}