Skip to content

Commit a81d441

Browse files
authored
Merge pull request moby#51534 from robmry/dont-remove-removed-gateway
Don't try to remove a cleared docker_gwbridge endpoint
2 parents d9ee22d + 1731e9e commit a81d441

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

daemon/libnetwork/endpoint.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,16 @@ func (ep *Endpoint) sbJoin(ctx context.Context, sb *Sandbox, options ...Endpoint
567567
if err := sb.populateNetworkResources(ctx, ep); err != nil {
568568
return err
569569
}
570+
571+
// If the old gateway was in the docker_gwbridge network, it's already been removed if
572+
// the new endpoint provides a gateway. Don't try to remove it again.
573+
if gwepBefore4 != nil && sb.GetEndpoint(gwepBefore4.ID()) == nil {
574+
gwepBefore4 = nil
575+
}
576+
if gwepBefore6 != nil && sb.GetEndpoint(gwepBefore6.ID()) == nil {
577+
gwepBefore6 = nil
578+
}
579+
570580
if err := ep.updateExternalConnectivity(ctx, sb, gwepBefore4, gwepBefore6); err != nil {
571581
return err
572582
}

0 commit comments

Comments
 (0)