Skip to content

Commit 31348af

Browse files
Roman VolosatovsthaJeztah
andcommitted
API: deprecate BuilderSize in API versions >= 1.42
Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Roman Volosatovs <roman.volosatovs@docker.com>
1 parent c81abef commit 31348af

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

api/server/router/system/system_routes.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,14 @@ func (s *systemRouter) getDiskUsage(ctx context.Context, w http.ResponseWriter,
113113
return err
114114
}
115115

116-
var builderSize int64
117-
for _, b := range buildCache {
118-
builderSize += b.Size
116+
if versions.LessThan(httputils.VersionFromContext(ctx), "1.42") {
117+
var builderSize int64
118+
for _, b := range buildCache {
119+
builderSize += b.Size
120+
}
121+
du.BuilderSize = builderSize
119122
}
120123

121-
du.BuilderSize = builderSize
122124
du.BuildCache = buildCache
123125
if buildCache == nil {
124126
// Ensure empty `BuildCache` field is represented as empty JSON array(`[]`)

api/types/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ type DiskUsage struct {
538538
Containers []*Container
539539
Volumes []*Volume
540540
BuildCache []*BuildCache
541-
BuilderSize int64 // deprecated
541+
BuilderSize int64 `json:",omitempty"` // Deprecated: deprecated in API 1.38, and no longer used since API 1.40.
542542
}
543543

544544
// ContainersPruneReport contains the response for Engine API:

docs/api/version-history.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ keywords: "API, Docker, rcli, REST, documentation"
1717

1818
[Docker Engine API v1.42](https://docs.docker.com/engine/api/v1.42/) documentation
1919

20+
* Removed the `BuilderSize` field on the `GET /system/df` endpoint. This field
21+
was introduced in API 1.31 as part of an experimental feature, and no longer
22+
used since API 1.40.
23+
Use field `BuildCache` instead to track storage used by the builder component.
24+
2025
## v1.41 API changes
2126

2227
[Docker Engine API v1.41](https://docs.docker.com/engine/api/v1.41/) documentation

0 commit comments

Comments
 (0)