Skip to content

Commit

Permalink
Docker - Load images
Browse files Browse the repository at this point in the history
Docker images don't load because `VirtualSize` attribute was removed from Docker Engine in v1.44.

---

Using `getOrDefault` for the `Created`, `Size` and `VirtualSize` attributes.

Using `Size` as default value to `VirtualSize`.

Annotating the `VirtualSize` attribute as deprecated
  • Loading branch information
lukaz-sampaio committed Jul 8, 2024
1 parent 0253a5d commit 7816b34
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public List<DockerImage> getImages() {
JSONObject json = (JSONObject) o;
JSONArray repoTags = (JSONArray) json.get("RepoTags");
String id = (String) json.get("Id");
long created = (long) json.get("Created");
long size = (long) json.get("Size");
long virtualSize = (long) json.get("VirtualSize");
long created = (long) json.getOrDefault("Created", 0L);
long size = (long) json.getOrDefault("Size", 0L);
long virtualSize = (long) json.getOrDefault("VirtualSize", size);
ret.add(new DockerImage(instance, repoTags, id, created, size, virtualSize));
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public long getSize() {
return size;
}

/**
* @deprecated Removed from Docker Engine in v1.44. Return size value.
* @return
*/
@Deprecated
public long getVirtualSize() {
return virtualSize;
}
Expand Down

0 comments on commit 7816b34

Please sign in to comment.