Skip to content

Conversation

@austinvazquez
Copy link
Contributor

@austinvazquez austinvazquez commented Nov 4, 2025

- What I did

This change vendors the tip of master branch (moby/moby@217fd78) for github.com/moby/moby/api and github.com/moby/moby/client.

- How I did it

- How to verify it

- Human readable description for the release notes

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2025

@austinvazquez
Copy link
Contributor Author

Hmm, I guess it needs to also handle the case for older API versions.

Comment on lines 38 to 44
ImageData struct {
TotalCount int64
ActiveCount int64
TotalSize int64
Reclaimable int64
Images []image.Summary
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked in-depth, but wondering if instead of defining our own structs in the CLI, if we could use the ones returned by the client directly?

At a quick glance, the difference is that these defined here use Images, Records, Containers as filename for the items, and the client uses a more generic Items. If that's the only difference, then, perhaps we can just adopt the type(s) as-is somehow?

@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch 5 times, most recently from c141d63 to b8668f7 Compare November 5, 2025 14:51
@austinvazquez austinvazquez changed the title vendor: github.com/moby/moby/api; github.com/moby/moby/client vendor: github.com/moby/moby/api master, moby/client master Nov 5, 2025
@thaJeztah thaJeztah force-pushed the vendor-system-disk-usage-changes branch 2 times, most recently from c539ada to 575d58e Compare November 6, 2025 12:56
@thaJeztah
Copy link
Member

Something seems borked in this PR (or in the client);

This is against the same daemon with v28.5;

docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          24        10        30.83GB   29.65GB (96%)
Containers      16        3         397.3kB   188.4kB (47%)
Local Volumes   7         3         7.078GB   6.308GB (89%)
Build Cache     517       0         21.44GB   21.44GB

and with this PR;

docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          0         0         30.83GB   0B (0%)
Containers      0         0         0B        0B
Local Volumes   0         0         0B        0B
Build Cache     0         0         0B        0B

@thaJeztah
Copy link
Member

Right, so a quick check to see what summaries the client returns, and I get this;

index 2c689da020..e5222f2d66 100644
--- a/cli/command/system/df.go
+++ b/cli/command/system/df.go
@@ -2,6 +2,8 @@

 import (
        "context"
+       "encoding/json"
+       "fmt"

        "github.com/docker/cli/cli"
        "github.com/docker/cli/cli/command"
@@ -54,6 +56,15 @@ func runDiskUsage(ctx context.Context, dockerCli command.Cli, opts diskUsageOpti
                format = formatter.TableFormatKey
        }

+       du2 := du
+       du2.Images.Items = nil
+       du2.BuildCache.Items = nil
+       du2.Containers.Items = nil
+       du2.Volumes.Items = nil
+
+       out, _ := json.Marshal(&du2)
+       fmt.Println(string(out))
+
        duCtx := formatter.DiskUsageContext{
                Context: formatter.Context{
                        Output: dockerCli.Out(),
{
  "Containers": {
    "ActiveContainers": 0,
    "TotalContainers": 0,
    "Reclaimable": 0,
    "TotalSize": 0,
    "Items": null
  },
  "Images": {
    "ActiveImages": 0,
    "TotalImages": 0,
    "Reclaimable": 0,
    "TotalSize": 30827314805,
    "Items": null
  },
  "BuildCache": {
    "ActiveBuildCacheRecords": 0,
    "TotalBuildCacheRecords": 0,
    "Reclaimable": 0,
    "TotalSize": 0,
    "Items": null
  },
  "Volumes": {
    "ActiveVolumes": 0,
    "TotalVolumes": 0,
    "Reclaimable": 0,
    "TotalSize": 0,
    "Items": null
  }
}

So it looks like the client doesn't calculate the totals

Comment on lines 257 to 295
func convertLegacyUsage(du system.DiskUsage) system.DiskUsage {
out := system.DiskUsage{
ImageUsage: &system.ImagesDiskUsage{
TotalSize: du.LayersSize,
TotalImages: int64(len(du.Images)),
Items: du.Images,
},
ContainerUsage: &system.ContainersDiskUsage{
TotalContainers: int64(len(du.Containers)),
Items: du.Containers,
},
VolumeUsage: &system.VolumesDiskUsage{
TotalVolumes: int64(len(du.Volumes)),
Items: du.Volumes,
},
BuildCacheUsage: &system.BuildCacheDiskUsage{
TotalBuildCacheRecords: int64(len(du.BuildCache)),
Items: du.BuildCache,
},
}
for _, img := range du.Images {
if img == nil {
continue
}
var size int64
if img.Size >= 0 && img.SharedSize >= 0 {
size = (img.Size - img.SharedSize)
}

if img.Containers > 0 {
out.ImageUsage.ActiveImages++
// FIXME(thaJeztah): this doesn't match the old output.
if out.ImageUsage.TotalSize > 0 {
out.ImageUsage.Reclaimable -= size
}
} else {
out.ImageUsage.Reclaimable += size
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Monkey-patching vendor, but values don't match yet;

Getting this;

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          24        10        30.83GB   4.192GB (13%)
Containers      16        0         0B        0B
Local Volumes   7         0         0B        0B
Build Cache     517       0         0B        0B

Instead of

docker system df
TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          24        9         30.83GB   30.43GB (98%)
Containers      15        2         274.4kB   188.4kB (68%)
Local Volumes   7         2         7.237GB   7.195GB (99%)
Build Cache     517       0         21.44GB   21.44GB

@thaJeztah thaJeztah force-pushed the vendor-system-disk-usage-changes branch 2 times, most recently from a0b1dc3 to 07a5275 Compare November 6, 2025 14:02
@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch 2 times, most recently from 403327f to 60ebc09 Compare November 6, 2025 20:03
@austinvazquez
Copy link
Contributor Author

New

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          9         3         33.28GB   3.019GB (9%)
Containers      9         5         1.779GB   249.9kB (0%)
Local Volumes   24        2         8.584GB   8.103GB (94%)
Build Cache     429       0         26.86GB   26.86GB

Old

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          9         3         33.28GB   30.85GB (92%)
Containers      9         5         1.779GB   249.9kB (0%)
Local Volumes   24        2         8.584GB   8.103GB (94%)
Build Cache     429       0         21.38GB   21.38GB

@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch from 60ebc09 to 9de7215 Compare November 6, 2025 21:19
@austinvazquez
Copy link
Contributor Author

New

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          9         3         33.28GB   30.85GB (92%)
Containers      9         5         1.78GB    249.9kB (0%)
Local Volumes   24        2         8.714GB   8.232GB (94%)
Build Cache     429       0         21.38GB   21.38GB

Old

TYPE            TOTAL     ACTIVE    SIZE      RECLAIMABLE
Images          9         3         33.28GB   30.85GB (92%)
Containers      9         5         1.78GB    249.9kB (0%)
Local Volumes   24        2         8.714GB   8.232GB (94%)
Build Cache     429       0         21.38GB   21.38GB

@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch from 9de7215 to 776730b Compare November 6, 2025 22:29
@austinvazquez austinvazquez marked this pull request as ready for review November 6, 2025 22:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the vendored dependencies for github.com/moby/moby/api and github.com/moby/moby/client to the latest master branch commits (as of November 6, 2025). The changes adapt the codebase to API modifications in the updated dependencies, primarily involving type conversions, method renaming, and structural updates to disk usage reporting.

  • Type changes: Several string fields changed to typed constants requiring explicit conversions (e.g., FailureAction, UpdateOrder, RegistryAuthSource)
  • API method renames: Prune methods changed from plural to singular forms (e.g., ImagesPruneImagePrune)
  • Structural changes: Result types changed from structs to interfaces, requiring updated mock implementations and disk usage context handling

Reviewed Changes

Copilot reviewed 25 out of 54 changed files in this pull request and generated no comments.

Show a summary per file
File Description
vendor.sum Updates checksums for the new moby/moby/api and moby/moby/client versions
vendor.mod Updates version references to pseudo-versions pointing to master branch commits
cli/compose/convert/service.go Adds type conversions for FailureAction and UpdateOrder fields
cli/compose/convert/service_test.go Converts UpdateOrder to string for test assertions
cli/command/volume/prune.go Renames method call from VolumesPrune to VolumePrune
cli/command/volume/client_test.go Updates test mock method from VolumesPrune to VolumePrune
cli/command/system/df.go Updates disk usage API call to use new Verbose option and restructured context fields
cli/command/system/client_test.go Renames test mock method from ContainersPrune to ContainerPrune
cli/command/service/update.go Adds type conversions for service update and rollback configuration fields
cli/command/service/opts_test.go Converts typed constants to strings for test flag setting and assertions
cli/command/service/opts.go Adds type conversions for update and rollback configuration options
cli/command/service/formatter.go Converts typed fields to strings for display formatting
cli/command/network/prune.go Renames method call from NetworksPrune to NetworkPrune
cli/command/image/save_test.go Changes mock return type from struct to io.ReadCloser
cli/command/image/prune_test.go Renames test function field from imagesPruneFunc to imagePruneFunc
cli/command/image/prune.go Renames method call from ImagesPrune to ImagePrune
cli/command/image/load_test.go Removes reflection-based mock and returns io.ReadCloser directly
cli/command/image/import_test.go Changes mock return type from struct to io.ReadCloser
cli/command/image/client_test.go Updates test client methods to use new API signatures and return types
cli/command/formatter/disk_usage.go Restructures disk usage context to use new client types instead of calculating locally
cli/command/formatter/buildcache.go Changes function signatures from pointer slices to value slices
cli/command/container/prune.go Renames method call from ContainersPrune to ContainerPrune
cli/command/container/exec_test.go Renames field from Tty to TTY
cli/command/container/exec.go Updates exec implementation to use renamed TTY field and new ConsoleSize structure
cli/command/container/client_test.go Removes reflection-based mocks and updates method signatures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

github.com/moby/go-archive v0.1.0
github.com/moby/moby/api v1.52.0-beta.4
github.com/moby/moby/client v0.1.0-beta.3
github.com/moby/moby/api v1.52.0-beta.4.0.20251106210608-f7fd9c315acf
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs 217fd7890581

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively, let's wait for the api/client to be tagged upstream

@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch from 776730b to de0b8d1 Compare November 6, 2025 22:48
@austinvazquez austinvazquez force-pushed the vendor-system-disk-usage-changes branch from de0b8d1 to 5039eee Compare November 6, 2025 23:02
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vvoland vvoland merged commit 16d2036 into docker:master Nov 6, 2025
120 of 123 checks passed
@austinvazquez austinvazquez deleted the vendor-system-disk-usage-changes branch November 6, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants