我无法将任何容器部署到我的 Docker Swarm。例如,在删除堆栈然后部署后,容器(服务)停留在当前状态待定数小时,没有任何反应。
ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
izwihmd5v5tj my-prod_db-local.1 postgres:11 Running Pending 5 hours ago
当您运行 docker inspect < ID > 时,您不会收到任何错误,而只是收到消息:“待处理任务调度”:
"Status": {
"Timestamp": "2023-12-27T13:55:35.786013412Z",
"State": "pending",
"Message": "pending task scheduling",
"PortStatus": {}
},
答案1
我正在运行 3 个主服务器。我首先在前两个服务器上重新启动了 dockerd,但没有帮助。但是,第三个 dockerd 主服务器抛出了堆栈跟踪(来自 /var/log/syslog)
Dec 27 16:17:36 server dockerd[2461573]: goroutine 1 [running, locked
to thread]: Dec 27 16:17:36 server dockerd[2461573]:
github.com/docker/docker/pkg/stack.dump(0xc00019e000?) Dec 27 16:17:36
server dockerd[2461573]:
#011/root/build-deb/engine/pkg/stack/stackdump.go:49 +0x5c Dec 27 16:17:36 server dockerd[2461573]:
github.com/docker/docker/pkg/stack.Dump(...) Dec 27 16:17:36 server
dockerd[2461573]: #011/root/build-deb/engine/pkg/stack/stackdump.go:18
Dec 27 16:17:36 server dockerd[2461573]:
github.com/docker/docker/daemon/cluster.(*Cluster).Cleanup(0xc0000559e0)
Dec 27 16:17:36 server dockerd[2461573]:
#011/root/build-deb/engine/daemon/cluster/cluster.go:396 +0x325 Dec 27 16:17:36 server dockerd[2461573]:
main.(*DaemonCli).start(0xc00059a040, 0xc000bfcfc0) Dec 27 16:17:36
server dockerd[2461573]:
#011/root/build-deb/engine/cmd/dockerd/daemon.go:307 +0x1765 Dec 27 16:17:36 server dockerd[2461573]: main.runDaemon(...) Dec 27 16:17:36
server dockerd[2461573]:
#011/root/build-deb/engine/cmd/dockerd/docker_unix.go:14 Dec 27 16:17:36 server dockerd[2461573]:
main.newDaemonCommand.func1(0xc000c28000?, {0xc000598060?, 0x1?, 0x1?})
跑步
systemctl restart docker
在崩溃的主服务器上修复了这个问题