Skip to content

fix: use DiskUsage instead of VolumeList to populate Volume.UsageData#746

Open
glav-git wants to merge 1 commit into
jesseduffield:masterfrom
glav-git:feature/issue-450
Open

fix: use DiskUsage instead of VolumeList to populate Volume.UsageData#746
glav-git wants to merge 1 commit into
jesseduffield:masterfrom
glav-git:feature/issue-450

Conversation

@glav-git
Copy link
Copy Markdown

@glav-git glav-git commented Jan 25, 2026

Fixes #450

Explanation:

The renderer of volumes list already had support for displaying Volume.UsageData:

if volume.Volume.UsageData != nil {
output += utils.WithPadding("RefCount: ", padding) + fmt.Sprintf("%d", volume.Volume.UsageData.RefCount) + "\n"
output += utils.WithPadding("Size: ", padding) + utils.FormatBinaryBytes(int(volume.Volume.UsageData.Size)) + "\n"
}

But it was never displayed, since according to Volume.UsageData field comment it was available only when using /system/df endpoint:

// UsageData Usage details about the volume. This information is used by the
// `GET /system/df` endpoint, and omitted in other endpoints.
//
// swagger:model UsageData
type UsageData struct {
// The number of containers referencing this volume. This field
// is set to `-1` if the reference-count is not available.
//
// Required: true
RefCount int64 `json:"RefCount"`
// Amount of disk space used by the volume (in bytes). This information
// is only available for volumes created with the `"local"` volume
// driver. For volumes created with other volume drivers, this field
// is set to `-1` ("not available")
//
// Required: true
Size int64 `json:"Size"`
}

Since DiskUsage returns literally the same Volume type as VolumeList - I was able to simply swap method calls (and add option to fetch only volumes data) and was proud to finally see Size and RefCount of my docker volume.

Before

image

After

image

@glav-git glav-git changed the title fix: use DiskUsage instead of VolumeList to populate Volume.UsageData.Size fix: use DiskUsage instead of VolumeList to populate Volume.UsageData Jan 25, 2026
@glav-git glav-git changed the title fix: use DiskUsage instead of VolumeList to populate Volume.UsageData fix: use DiskUsage instead of VolumeList to populate Volume.UsageData Jan 25, 2026
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.

Add volume links and size columns for volumes panel

1 participant