Skip to content

docker swarm update --task-history-limit does not take effect #1529

Open

Description

@zgh1102

I am using Docker version 28.0.1. After initializing a Docker Swarm cluster, I executed the following command to limit the task history:
docker swarm update --task-history-limit 1
However, after deploying and repeatedly updating services, I noticed that each task still retains more than one historical record, which seems to indicate that the --task-history-limit option is not working as expected.

Is this a known issue, or am I missing something? Any guidance would be appreciated.

Steps to Reproduce:
Initialize a Docker Swarm cluster.
Run docker swarm update --task-history-limit 1.
Deploy a service and update it multiple times.
Check the task history using docker service ps <service_name>.
Expected Behavior:
Only one historical task record should be kept per service.

Actual Behavior:
More than one historical task record is retained.

root@docker-swarm-manager:~# docker info | grep "Task History"
Task History Retention Limit: 1

Client: Docker Engine - Community
Version: 28.0.1
API version: 1.48
Go version: go1.23.6
Git commit: 068a01e
Built: Wed Feb 26 10:41:08 2025
OS/Arch: linux/amd64
Context: default

Server: Docker Engine - Community
Engine:
Version: 28.0.1
API version: 1.48 (minimum version 1.24)
Go version: go1.23.6
Git commit: bbd0a17
Built: Wed Feb 26 10:41:08 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.25
GitCommit: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
runc:
Version: 1.2.4
GitCommit: v1.2.4-0-g6c52b3f
docker-init:
Version: 0.19.0
GitCommit: de40ad0

Activity

  1. phanxlee commented on Nov 19, 2026

    @phanxlee

    If your service set restart-max-attempts , --task-history-limit may not take effect.

    docker service inspect <your service> | grep MaxAttempts | head -1

    see Improperly working task-history-limit destroys swarm cluster and 'logs' command
    #35637

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions