Remove network info from container when endpoint join fails

Signed-off-by: Rob Murray <rob.murray@docker.com>
This commit is contained in:
Rob Murray
2025-09-09 18:40:17 +01:00
parent 3278393cf2
commit b192d06ec7

View File

@@ -735,10 +735,14 @@ func (daemon *Daemon) connectToNetwork(ctx context.Context, cfg *config.Config,
}
}
}()
ctr.NetworkSettings.Networks[nwName] = endpointConfig
delete(ctr.NetworkSettings.Networks, n.ID())
ctr.NetworkSettings.Networks[nwName] = endpointConfig
defer func() {
if retErr != nil {
delete(ctr.NetworkSettings.Networks, nwName)
}
}()
if err := daemon.updateEndpointNetworkSettings(cfg, ctr, n, ep); err != nil {
return err
}