Merge pull request #52053 from thaJeztah/simplify_inspect

daemon: Daemon.getInspectData: unify platform-specific fields
This commit is contained in:
Sebastiaan van Stijn
2026-02-20 21:49:46 +01:00
committed by GitHub
3 changed files with 15 additions and 41 deletions

View File

@@ -137,22 +137,23 @@ func (daemon *Daemon) getInspectData(daemonCfg *config.Config, ctr *container.Co
FinishedAt: ctr.State.FinishedAt.Format(time.RFC3339Nano),
Health: containerHealth,
},
Image: ctr.ImageID.String(),
LogPath: ctr.LogPath,
Name: ctr.Name,
RestartCount: ctr.RestartCount,
Driver: ctr.Driver,
Platform: ctr.ImagePlatform.OS,
MountLabel: ctr.MountLabel,
ProcessLabel: ctr.ProcessLabel,
ExecIDs: ctr.GetExecIDs(),
HostConfig: &hostConfig,
Config: ctr.Config,
Image: ctr.ImageID.String(),
ResolvConfPath: ctr.ResolvConfPath, // Only used on Linux.
HostnamePath: ctr.HostnamePath, // Only used on Linux.
HostsPath: ctr.HostsPath, // Only used on Linux.
LogPath: ctr.LogPath,
Name: ctr.Name,
RestartCount: ctr.RestartCount,
Driver: ctr.Driver,
Platform: ctr.ImagePlatform.OS,
MountLabel: ctr.MountLabel, // Only used on Linux.
ProcessLabel: ctr.ProcessLabel, // Only used on Linux.
AppArmorProfile: ctr.AppArmorProfile, // Only used on Linux.
ExecIDs: ctr.GetExecIDs(),
HostConfig: &hostConfig,
Config: ctr.Config,
}
// Now set any platform-specific fields
inspectResponse = setPlatformSpecificContainerFields(ctr, inspectResponse)
if daemon.UsesSnapshotter() {
inspectResponse.Storage = &storage.Storage{
RootFS: &storage.RootFSStorage{

View File

@@ -1,16 +0,0 @@
package daemon
import (
"github.com/moby/moby/api/types/container"
containerpkg "github.com/moby/moby/v2/daemon/container"
)
// This sets platform-specific fields
func setPlatformSpecificContainerFields(ctr *containerpkg.Container, resp *container.InspectResponse) *container.InspectResponse {
resp.AppArmorProfile = ctr.AppArmorProfile
resp.ResolvConfPath = ctr.ResolvConfPath
resp.HostnamePath = ctr.HostnamePath
resp.HostsPath = ctr.HostsPath
return resp
}

View File

@@ -1,11 +0,0 @@
package daemon
import (
"github.com/moby/moby/api/types/container"
containerpkg "github.com/moby/moby/v2/daemon/container"
)
// This sets platform-specific fields
func setPlatformSpecificContainerFields(ctr *containerpkg.Container, resp *container.InspectResponse) *container.InspectResponse {
return resp
}