1 Star 0 Fork 58

gnaygnil/docker

forked from src-openEuler/docker 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0107-restore-cleanup-container-meta-data-when-task.patch 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
gnaygnil 提交于 2020-02-13 15:36 . docker: Fixed build error and URL
From 2e5c40ed0ddf40db1ad0e6964e4391ff6bc8e9e1 Mon Sep 17 00:00:00 2001
From: jingrui <jingrui@huawei.com>
Date: Fri, 22 Feb 2019 00:13:07 +0800
Subject: [PATCH 107/111] restore: cleanup container meta data when
task not exist
reason: docker_hook:testCE_docker_hook_spec_ABN.081.sh
create container include 2 step:
1. create meta data.
2. create task.
when dockerd restart during creating, it may residue meta while create
task failed. cleanup meta data in restore.
Change-Id: I80ea1694e3df143c4a5679f680e61d43ddcfe3aa
Signed-off-by: jingrui <jingrui@huawei.com>
---
components/engine/daemon/daemon.go | 4 ++++
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/components/engine/daemon/daemon.go b/components/engine/daemon/daemon.go
index e26494ed68..c96e28d88d 100644
--- a/components/engine/daemon/daemon.go
+++ b/components/engine/daemon/daemon.go
@@ -365,6 +365,10 @@ func (daemon *Daemon) restore() error {
}
if !alive {
ec, exitedAt, err = daemon.containerd.DeleteTask(context.Background(), c.ID)
+ if err != nil && errdefs.IsNotFound(err) {
+ err := daemon.containerd.Delete(context.Background(), c.ID)
+ logrus.Infof("cleanup containerd meta for %s error=%v", c.ID, err)
+ }
if err != nil && !errdefs.IsNotFound(err) {
logrus.WithError(err).Errorf("Failed to delete container %s from containerd", c.ID)
return
--
2.17.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/gnaygnil/docker.git
git@gitee.com:gnaygnil/docker.git
gnaygnil
docker
docker
master

搜索帮助