我正在使用Docker Swarm来测试AWS上的服务.我最近对此服务应用了这样的更新:
docker service update --image TestImage:v2 --update-parallelism 2 \ --update-delay 10s TestService2
更新按预期工作,服务将任务容器更新为v2.然而,快速docker service ps TestService2 | grep "v1"
揭示了一堆关机TestImage:v1
任务.
a0w77kj0k6jfg4r9g4nz47zzg \_ TestService2.1 TestImage:v1 W1 Shutdown Shutdown 36 minutes ago 2of4mc63ekzbib01w3x7q6sdm \_ TestService2.2 TestImage:v1 W2 Shutdown Shutdown 37 minutes ago 495frrpza5pxt205o1594x54a \_ TestService2.3 TestImage:v1 W1 Shutdown Shutdown 36 minutes ago 57l0gsqd26u2e5gdj30w8mcn9 \_ TestService2.4 TestImage:v1 M1 Shutdown Shutdown 36 minutes ago baoe1i79fswb34ydwbpafg6tm \_ TestService2.5 TestImage:v1 M3 Shutdown Shutdown 35 minutes ago 3uxi7kwxb73z69km6s17son58 \_ TestService2.6 TestImage:v1 M2 Shutdown Shutdown 37 minutes ago 99cg4arnt1y52nd8d422bdu49 \_ TestService2.7 TestImage:v1 M3 Shutdown Shutdown 36 minutes ago cq5716jqp40h6jugo1j9ilzwp \_ TestService2.8 TestImage:v1 M1 Shutdown Shutdown 35 minutes ago awlz1kxbrjk51dey7frm14d8u \_ TestService2.9 TestImage:v1 W3 Shutdown Shutdown 35 minutes ago 4xdi9a1jweyehfqlt76uynf3i \_ TestService2.10 TestImage:v1 M2 Shutdown Shutdown 36 minutes ago eo4t6i0gaj5i294fcdnb3qncq \_ TestService2.11 TestImage:v1 W3 Shutdown Shutdown 35 minutes ago 3ydeuxdjquulv5xj94b9ovuwu \_ TestService2.12 TestImage:v1 W1 Shutdown Shutdown 36 minutes ago
如何在不去往每个单独的swarm节点并docker rm
在已退出的容器上运行的情况下删除它们?我不认为这是一个docker service
命令,我已经浏览了文档,但是有没有人知道我可以在Swarm Manager上运行的hack或脚本来清理节点?
谢谢!
滚动更新后,将删除这些服务的容器; 你只需要留下那些被关闭的日志.
您可以限制使用的数字
docker swarm update --task-history-limit 5