docker: cleanup netns file when stop docker daemon
fix #I5W2XY (cherry picked from commit a81ea9875a9ca5bb61fcccc747b4a9f73a175680)
This commit is contained in:
parent
ec2ddd5603
commit
3d41826f07
@ -1 +1 @@
|
||||
18.09.0.244
|
||||
18.09.0.245
|
||||
|
||||
@ -199,6 +199,12 @@ fi
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Tue Nov 22 2022 chenjiankun<chenjiankun1@huawei.com> - 18.09.0-245
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC:cleanup netns file when stop docker daemon
|
||||
|
||||
* Sat Oct 15 2022 DCCooper <1866858@gmail.com> - 18.09.0-244
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
From 26f9b14362ee9859e221e73e57b73abbe7f812f8 Mon Sep 17 00:00:00 2001
|
||||
From: chenjiankun <chenjiankun1@huawei.com>
|
||||
Date: Thu, 8 Sep 2022 20:41:30 +0800
|
||||
Subject: [PATCH] docker: cleanup netns file when close docker daemon
|
||||
|
||||
When the docker daemon shutdown, if LiveRestoreEnabled is true and
|
||||
there are containers still running, we will not call the netns GC
|
||||
and will cause netns file leak. We need to call netns GC manually.
|
||||
---
|
||||
components/engine/daemon/daemon.go | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go
|
||||
index 5c6be8e45..6e3477bf5 100644
|
||||
--- a/components/engine/daemon/daemon.go
|
||||
+++ b/components/engine/daemon/daemon.go
|
||||
@@ -70,6 +70,7 @@ import (
|
||||
"github.com/docker/libnetwork"
|
||||
"github.com/docker/libnetwork/cluster"
|
||||
nwconfig "github.com/docker/libnetwork/config"
|
||||
+ "github.com/docker/libnetwork/osl"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
@@ -1295,6 +1296,10 @@ func (daemon *Daemon) ShutdownTimeout() int {
|
||||
// Shutdown stops the daemon.
|
||||
func (daemon *Daemon) Shutdown() error {
|
||||
daemon.shutdown = true
|
||||
+
|
||||
+ // netns file in GC need some cleanup first
|
||||
+ osl.GC()
|
||||
+
|
||||
// Keep mounts and networking running on daemon shutdown if
|
||||
// we are to keep containers running and restore them.
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -225,4 +225,5 @@ patch/0228-docker-fix-terminal-abnormal-after-docker-run.patch
|
||||
patch/0229-docker-Add-an-ExitPid-field-for-State-struct-to-reco.patch
|
||||
patch/0230-docker-AdditionalGids-must-include-effective-group-I.patch
|
||||
patch/0231-docker-ensure-layer-digest-folder-removed-if-ls.driv.patch
|
||||
patch/0232-docker-cleanup-netns-file-when-close-docker-daemon.patch
|
||||
#end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user