'Docker REST API always returing -1 as the number of containers per image

When I perform a GET on the following URL:

http://172.17.35.129:2375/images/json?all=true

The answer is like the following:

{
    "Containers": -1,
    "Created": 1646338773,
    "Id": "sha256:2b4cba85892afc2ad8ce258a8e3d9daa4a1626ba380677cee93ef2338da442ab",
    "Labels": null,
    "ParentId": "",
    "RepoDigests": [
        "ubuntu@sha256:8ae9bafbb64f63a50caab98fd3a5e37b3eb837a3e0780b78e5218e63193961f9"
    ],
    "RepoTags": [
        "ubuntu:latest"
    ],
    "SharedSize": -1,
    "Size": 72759661,
    "VirtualSize": 72759661
}

As you can see the number of containers is -1. The same goes for all other images even if I have some images from which I have several containers running.

Do you know why -1 is always returned ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source