我已经尝试了所有方法,但无法运行 exec 类型的作业。我在 3 个不同的集群上尝试过,但都失败了。
该作业修剪 docker 容器并仅运行 docker system prune -a
。
这是配置部分:
driver = "exec"
config {
command = "bash"
args = ["-c",
" docker system prune -a "]
}
没有日志和容器不被修剪:
job "docker-cleanup" {
type = "system"
constraint {
attribute = "${attr.kernel.name}"
operator = "="
value = "linux"
}
datacenters = ["dc1"]
group "docker-cleanup" {
restart {
interval = "24h"
attempts = 0
mode = "fail"
}
task "docker-system-prune" {
driver = "exec"
config {
command = "bash"
args = ["-c",
" docker system prune -a "]
}
resources {
cpu = 100
memory = 50
network {
mbits = 1
}
}
}
}
}
我究竟做错了什么?