Docker Community Forums

Share and learn in the Docker community.

Difference between "GET /images/json" and "GET /images/(name)/json" rest API endpoint

docker

(Greenday) #1

Hi,

With GET /images/json rest API, I get the following information about a image

[
    {
        .....
        **"Id": "35ae2647a35e3f93ed33d109daec2c1cca11662d0372e959d4d7a39f44a031f3",**
        "Labels": {},
        "ParentId": "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
        .....
]

And with GET /images/35ae/json, I get following information about a image

{
    ....
	
    "Container": "a9b29366c7c253628a969653464cb651a8f554ac23c4f439582db94cd5304b39",
    **"Id": "35ae2647a35e3f93ed33d109daec2c1cca11662d0372e959d4d7a39f44a031f3",**
    "Os": "linux",
    "Parent": "91e54dfb11794fad694460162bf0cb0a4fa710cfa3f60979c177d920813e267c",
    .....	
}

That means, when I want to find out the containers associated with all the images on the system through rest API, I will have to list all the images using end point “GET /images/json” and then for each one again use REST API “GET /images//json” to find the corresponding container.

It seems I can avoid all the “inspect image” calls if I found the container id associated with image during “listing of the images”. I would like to know if there is a way to achieve this or I have no alternative but make a “Image Inspect” call for each image.