2022-06-29 09:39:40 +08:00
|
|
|
From ba62de1350b25ec1d85eff67bd3c8c5be98d02a7 Mon Sep 17 00:00:00 2001
|
2022-06-28 16:29:12 +08:00
|
|
|
From: chenjiankun <chenjiankun1@huawei.com>
|
2022-06-29 09:39:40 +08:00
|
|
|
Date: Thu, 17 Mar 2022 20:18:30 +0800
|
2022-06-28 16:29:12 +08:00
|
|
|
Subject: [PATCH] docker: fix "endpoint with name container_xx already exists
|
|
|
|
|
in network none" error
|
|
|
|
|
|
|
|
|
|
---
|
2022-06-29 09:39:40 +08:00
|
|
|
components/engine/daemon/kill.go | 11 ++++++++++-
|
|
|
|
|
1 file changed, 10 insertions(+), 1 deletion(-)
|
2022-06-28 16:29:12 +08:00
|
|
|
|
|
|
|
|
diff --git a/components/engine/daemon/kill.go b/components/engine/daemon/kill.go
|
2022-06-29 09:39:40 +08:00
|
|
|
index 2652f7ad2..cb0ec61d1 100644
|
2022-06-28 16:29:12 +08:00
|
|
|
--- a/components/engine/daemon/kill.go
|
|
|
|
|
+++ b/components/engine/daemon/kill.go
|
2022-06-29 09:39:40 +08:00
|
|
|
@@ -162,7 +162,16 @@ func (daemon *Daemon) Kill(container *containerpkg.Container) error {
|
|
|
|
|
if isErrNoSuchProcess(err) {
|
2022-06-28 16:29:12 +08:00
|
|
|
// there is a case where we hit here before the exit event is processed
|
|
|
|
|
// So let's wait the container's stop timeout amount of time to see if the event is eventually processed
|
2022-06-29 09:39:40 +08:00
|
|
|
- container.WaitForState(containerpkg.WaitConditionNotRunning, container.StopTimeout())
|
|
|
|
|
+ if err := container.WaitForState(containerpkg.WaitConditionNotRunning, container.StopTimeout()); err != nil {
|
|
|
|
|
+ ei := libcontainerd.EventInfo{
|
|
|
|
|
+ ContainerID: container.ID,
|
|
|
|
|
+ ProcessID: container.ID,
|
|
|
|
|
+ Pid: uint32(container.GetPID()),
|
|
|
|
|
+ ExitCode: 137,
|
|
|
|
|
+ ExitedAt: time.Now(),
|
|
|
|
|
+ }
|
|
|
|
|
+ daemon.ProcessEvent(container.ID, libcontainerd.EventExit, ei)
|
2022-06-28 16:29:12 +08:00
|
|
|
+ }
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return err
|
|
|
|
|
--
|
2022-06-29 09:39:40 +08:00
|
|
|
2.23.0
|