Skip to content

Commit 9b20b1a

Browse files
authored
Merge pull request #46702 from thaJeztah/24.0_backport_releaseNetwork_NetworkDisabled
[24.0 backport] daemon: release sandbox even when NetworkDisabled
2 parents c2e7c32 + 05d95fd commit 9b20b1a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

daemon/container_operations.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,10 +1027,17 @@ func (daemon *Daemon) getNetworkedContainer(containerID, connectedContainerID st
10271027

10281028
func (daemon *Daemon) releaseNetwork(container *container.Container) {
10291029
start := time.Now()
1030+
// If live-restore is enabled, the daemon cleans up dead containers when it starts up. In that case, the
1031+
// netController hasn't been initialized yet and so we can't proceed.
1032+
// TODO(aker): If we hit this case, the endpoint state won't be cleaned up (ie. no call to cleanOperationalData).
10301033
if daemon.netController == nil {
10311034
return
10321035
}
1033-
if container.HostConfig.NetworkMode.IsContainer() || container.Config.NetworkDisabled {
1036+
// If the container uses the network namespace of another container, it doesn't own it -- nothing to do here.
1037+
if container.HostConfig.NetworkMode.IsContainer() {
1038+
return
1039+
}
1040+
if container.NetworkSettings == nil {
10341041
return
10351042
}
10361043

0 commit comments

Comments
 (0)