Q:

How to clear Docker task history

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. 

How do I clear this log without removing the service?

A:

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/

