Merge pull request #27172 from ninja-quokka/docker_compate_145

[compat api] Remove ContainerConfig field
This commit is contained in:
openshift-merge-bot[bot]
2025-09-29 13:45:07 +00:00
committed by GitHub
4 changed files with 36 additions and 22 deletions

View File

@@ -390,24 +390,23 @@ func imageDataToImageInspect(ctx context.Context, l *libimage.Image, r *http.Req
cc.Volumes = info.Config.Volumes
dockerImageInspect := dockerImage.InspectResponse{
Architecture: info.Architecture,
Author: info.Author,
Comment: info.Comment,
Config: &config,
ContainerConfig: cc,
Created: l.Created().Format(time.RFC3339Nano),
DockerVersion: info.Version,
GraphDriver: graphDriver,
ID: "sha256:" + l.ID(),
Metadata: dockerImage.Metadata{},
Os: info.Os,
OsVersion: info.Version,
Parent: info.Parent,
RepoDigests: info.RepoDigests,
RepoTags: info.RepoTags,
RootFS: rootfs,
Size: info.Size,
Variant: "",
Architecture: info.Architecture,
Author: info.Author,
Comment: info.Comment,
Config: &config,
Created: l.Created().Format(time.RFC3339Nano),
DockerVersion: info.Version,
GraphDriver: graphDriver,
ID: "sha256:" + l.ID(),
Metadata: dockerImage.Metadata{},
Os: info.Os,
OsVersion: info.Version,
Parent: info.Parent,
RepoDigests: info.RepoDigests,
RepoTags: info.RepoTags,
RootFS: rootfs,
Size: info.Size,
Variant: "",
}
if _, err := apiutil.SupportedVersion(r, "<1.44.0"); err == nil {
@@ -415,6 +414,10 @@ func imageDataToImageInspect(ctx context.Context, l *libimage.Image, r *http.Req
dockerImageInspect.VirtualSize = info.VirtualSize
}
if _, err := apiutil.SupportedVersion(r, "<1.45.0"); err == nil {
dockerImageInspect.ContainerConfig = cc //nolint:staticcheck // Deprecated field
}
return &handlers.ImageInspect{InspectResponse: dockerImageInspect}, nil
}

View File

@@ -20,8 +20,13 @@ type AuthConfig struct {
type ImageInspect struct {
dockerImage.InspectResponse
// Container is for backwards compat but is basically unused
Container string
// When you embed a struct, the fields of the embedded struct are "promoted" to the outer struct.
// If a field in the outer struct has the same name as a field in the embedded struct,
// the outer struct's field will shadow or override the embedded one allowing for a clean way to
// hide fields from the swagger spec that still exist in the libraries struct.
Container string `json:"-"`
ContainerConfig string `json:"-"`
VirtualSize string `json:"-"`
}
type ContainerConfig struct {