Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear Docker task history

Tags:

linux

docker

When running docker in swarm mode, a history of past tasks accumulate as docker services are updated. Running docker node ps displays the log of tasks.

enter image description here

How do I clear this log without removing the service?

like image 443
Geige V Avatar asked Feb 21 '17 10:02

Geige V


2 Answers

You can adjust the history limit in swarm by running:

docker swarm update --task-history-limit=1

Which will only keep one previous task instead of the default 5. See the cli docs for more details: https://docs.docker.com/engine/reference/commandline/swarm_update/

like image 153
BMitch Avatar answered Nov 05 '22 22:11

BMitch


Instead this worked better to clear task history and show only the current running containers.

#docker swarm update --task-history-limit 0
like image 24
Vinayak Avatar answered Nov 05 '22 21:11

Vinayak