mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Do not update hosts file with internal networks endpoint IP
Signed-off-by: Alessandro Boch <aboch@docker.com>
This commit is contained in:
parent
6b74a8d479
commit
b859ce411b
1 changed files with 12 additions and 6 deletions
|
@ -469,12 +469,14 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
||||||
n.getController().watchSvcRecord(ep)
|
n.getController().watchSvcRecord(ep)
|
||||||
}
|
}
|
||||||
|
|
||||||
address := ""
|
if doUpdateHostsFile(n, sb) {
|
||||||
if ip := ep.getFirstInterfaceAddress(); ip != nil {
|
address := ""
|
||||||
address = ip.String()
|
if ip := ep.getFirstInterfaceAddress(); ip != nil {
|
||||||
}
|
address = ip.String()
|
||||||
if err = sb.updateHostsFile(address); err != nil {
|
}
|
||||||
return err
|
if err = sb.updateHostsFile(address); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if err = sb.updateDNS(n.enableIPv6); err != nil {
|
if err = sb.updateDNS(n.enableIPv6); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -548,6 +550,10 @@ func (ep *endpoint) sbJoin(sb *sandbox, options ...EndpointOption) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func doUpdateHostsFile(n *network, sb *sandbox) bool {
|
||||||
|
return !n.ingress && n.Name() != libnGWNetwork
|
||||||
|
}
|
||||||
|
|
||||||
func (ep *endpoint) rename(name string) error {
|
func (ep *endpoint) rename(name string) error {
|
||||||
var err error
|
var err error
|
||||||
n := ep.getNetwork()
|
n := ep.getNetwork()
|
||||||
|
|
Loading…
Add table
Reference in a new issue