Merge pull request #41081 from thaJeztah/19.03_backport_fix_sandbox_cleanup
[19.03 backport] allocateNetwork: fix network sandbox not cleaned up on failure
This commit is contained in:
commit
2d4bfdc789
1 changed files with 2 additions and 2 deletions
|
@ -509,7 +509,7 @@ func (daemon *Daemon) updateContainerNetworkSettings(container *container.Contai
|
|||
}
|
||||
}
|
||||
|
||||
func (daemon *Daemon) allocateNetwork(container *container.Container) error {
|
||||
func (daemon *Daemon) allocateNetwork(container *container.Container) (retErr error) {
|
||||
start := time.Now()
|
||||
controller := daemon.netController
|
||||
|
||||
|
@ -577,7 +577,7 @@ func (daemon *Daemon) allocateNetwork(container *container.Container) error {
|
|||
}
|
||||
updateSandboxNetworkSettings(container, sb)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
if retErr != nil {
|
||||
sb.Delete()
|
||||
}
|
||||
}()
|
||||
|
|
Loading…
Reference in a new issue