移除故障节点后Docker Swarm中的孤立任务 [英] Orphaned Tasks in Docker Swarm after removal of failed node

查看:65
本文介绍了移除故障节点后Docker Swarm中的孤立任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上周,我不得不从Docker Swarm集群中删除发生故障的节点,使在该节点上运行的某些任务处于所需的状态删除".

Last week I had to remove a failed node from my Docker Swarm Cluster, leaving some tasks that ran on that node in desired state "Remove".

即使删除堆栈并使用相同的名称重新创建堆栈, docker stack ps stackname 仍会显示它们.

Even after deleting the stack and recreating it with the same name, docker stack ps stackname still shows them.

有趣的是,在重新创建堆栈之后,任务仍然存在,但未分配节点.

Interestingly enough, after recreating the stack, the tasks are still there, but with no node assigned.

这是到目前为止我尝试清理"堆栈的方法:

Here's what I tried so far to "cleanup" the stack:

  • 重新创建具有相同名称的堆栈
  • docker容器修剪
  • docker volume prune
  • docker系统修剪

是否可以删除特定任务?

Is there a way to remove a specific task?

这是 docker inspect fkgz0oihexzs 的输出,这是列表中的第一个任务:

Here's the output for docker inspect fkgz0oihexzs, the first task in the list:

[
  {
    "ID": "fkgz0oihexzsjqwv4ju0szorh",
    "Version": {
      "Index": 14422171
    },
    "CreatedAt": "2018-11-05T16:15:31.528933998Z",
    "UpdatedAt": "2018-11-05T16:27:07.422368364Z",
    "Labels": {},
    "Spec": {
      "ContainerSpec": {
        "Image": "redacted",
        "Labels": {
          "com.docker.stack.namespace": "redacted"
        },
        "Env": [
          "redacted"
        ],
        "Privileges": {
          "CredentialSpec": null,
          "SELinuxContext": null
        },
        "Isolation": "default"
      },
      "Resources": {},
      "Placement": {
        "Platforms": [
          {
            "Architecture": "amd64",
            "OS": "linux"
          }
        ]
      },
      "Networks": [
        {
          "Target": "3i998stqemnevzgiqw3ndik4f",
          "Aliases": [
            "redacted"
          ]
        }
      ],
      "ForceUpdate": 0
    },
    "ServiceID": "g3vk9tgfibmcigmf67ik7uhj6",
    "Slot": 1,
    "Status": {
      "Timestamp": "2018-11-05T16:15:31.528892467Z",
      "State": "new",
      "Message": "created",
      "PortStatus": {}
    },
    "DesiredState": "remove"
  }
]


推荐答案

我遇到了同样的问题.我按照此说明

I had the same problem. I resolved it following this instructions :

docker run --rm -v /var/run/docker/swarm/control.sock:/var/run/swarmd.sock dperny/tasknuke <taskid>

请确保使用完整的长任务ID,否则将无法正常工作(在您的情况下为 fkgz0oihexzsjqwv4ju0szorh ).

Be sure to use the full long task id or it will not work (fkgz0oihexzsjqwv4ju0szorh in your case).

这篇关于移除故障节点后Docker Swarm中的孤立任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆