Merge pull request #51101 from thaJeztah/less_dockerversion

daemon: stop propagating Image.DockerVersion, Plugin.Config.DockerVersion fields
This commit is contained in:
Sebastiaan van Stijn
2025-10-07 13:01:13 +02:00
committed by GitHub
5 changed files with 17 additions and 28 deletions

View File

@@ -7,7 +7,6 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/network"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/dockerversion"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -18,13 +17,12 @@ import (
// - Details
func dockerOciImageToDockerImagePartial(id image.ID, img dockerspec.DockerOCIImage) *image.Image {
v1Image := image.V1Image{
DockerVersion: dockerversion.Version,
Config: dockerOCIImageConfigToContainerConfig(img.Config),
Architecture: img.Platform.Architecture,
Variant: img.Platform.Variant,
OS: img.Platform.OS,
Author: img.Author,
Created: img.Created,
Config: dockerOCIImageConfigToContainerConfig(img.Config),
Architecture: img.Platform.Architecture,
Variant: img.Platform.Variant,
OS: img.Platform.OS,
Author: img.Author,
Created: img.Created,
}
out := image.NewImage(id)

View File

@@ -14,7 +14,6 @@ import (
"github.com/moby/moby/v2/daemon/builder/dockerfile"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/daemon/internal/layer"
"github.com/moby/moby/v2/dockerversion"
"github.com/moby/moby/v2/errdefs"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -53,13 +52,12 @@ func (i *ImageService) ImportImage(ctx context.Context, newRef reference.Named,
created := time.Now().UTC()
imgConfig, err := json.Marshal(&image.Image{
V1Image: image.V1Image{
DockerVersion: dockerversion.Version,
Config: config,
Architecture: platform.Architecture,
Variant: platform.Variant,
OS: platform.OS,
Created: &created,
Comment: msg,
Config: config,
Architecture: platform.Architecture,
Variant: platform.Variant,
OS: platform.OS,
Created: &created,
Comment: msg,
},
RootFS: &image.RootFS{
Type: "layers",

View File

@@ -11,7 +11,6 @@ import (
"github.com/moby/moby/v2/daemon/builder"
"github.com/moby/moby/v2/daemon/internal/image"
"github.com/moby/moby/v2/daemon/internal/layer"
"github.com/moby/moby/v2/dockerversion"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors"
)
@@ -141,12 +140,11 @@ func (ic *ImageCache) restoreCachedImage(parent, target *image.Image, cfg *conta
restoredImg := image.Image{
V1Image: image.V1Image{
DockerVersion: dockerversion.Version,
Config: cfg,
Architecture: target.Architecture,
OS: target.OS,
Author: target.Author,
Created: history[len(history)-1].Created,
Config: cfg,
Architecture: target.Architecture,
OS: target.OS,
Author: target.Author,
Created: history[len(history)-1].Created,
},
RootFS: rootFS,
History: history,

View File

@@ -11,7 +11,6 @@ import (
"github.com/moby/moby/api/types/container"
"github.com/moby/moby/v2/daemon/internal/layer"
"github.com/moby/moby/v2/dockerversion"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -236,7 +235,6 @@ func NewChildImage(img *Image, child ChildConfig, os string) *Image {
return &Image{
V1Image: V1Image{
DockerVersion: dockerversion.Version,
Config: child.Config,
Architecture: img.BaseImgArch(),
Variant: img.BaseImgVariant(),

View File

@@ -32,7 +32,6 @@ import (
"github.com/moby/moby/v2/daemon/internal/stringid"
v2 "github.com/moby/moby/v2/daemon/pkg/plugin/v2"
"github.com/moby/moby/v2/daemon/server/backend"
"github.com/moby/moby/v2/dockerversion"
"github.com/moby/moby/v2/errdefs"
"github.com/moby/moby/v2/pkg/authorization"
"github.com/moby/moby/v2/pkg/pools"
@@ -707,8 +706,6 @@ func (pm *Manager) CreateFromContext(ctx context.Context, tarCtx io.ReadCloser,
DiffIds: []string{rootFSBlob.Digest().String()},
}
config.DockerVersion = dockerversion.Version //nolint:staticcheck // ignore SA1019: field is deprecated.
configBlob, err := pm.blobStore.Writer(ctx, content.WithRef(name+"-config.json"))
if err != nil {
return err