From 2a867f0c4d994c54d668169423ae4d49d8e8ba96 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Tue, 16 Sep 2025 17:59:02 +0200 Subject: [PATCH] daemon/server/backend: remove ExecInspect, ExecProcessConfig alias Type type was defined before the API had a definition fro the exec-inspect response. When a type definition was added in [moby@2a34207], the definition was moved from the backend to the API, and the backend type implemented as an alias. Technically, we could keep a _concrete_ type for the backend, and handle conversion to the corresponding API type in the router, but currently, this would likely only add extra complexity. We could still opt for doing so when the backend requires additional fields or changes that should not be reflected in the API response. [moby@2a34207]: https://github.com/moby/moby/commit/2a342079c632ee9b253fd5c497ce9dad82cf3a18 Signed-off-by: Sebastiaan van Stijn --- daemon/inspect.go | 6 +++--- daemon/server/backend/backend.go | 8 -------- daemon/server/router/container/backend.go | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/daemon/inspect.go b/daemon/inspect.go index d2991f806e..c17f825d4c 100644 --- a/daemon/inspect.go +++ b/daemon/inspect.go @@ -184,7 +184,7 @@ func (daemon *Daemon) getInspectData(daemonCfg *config.Config, ctr *container.Co // ContainerExecInspect returns low-level information about the exec // command. An error is returned if the exec cannot be found. -func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, error) { +func (daemon *Daemon) ContainerExecInspect(id string) (*containertypes.ExecInspectResponse, error) { e := daemon.execCommands.Get(id) if e == nil { return nil, errExecNotFound(id) @@ -209,11 +209,11 @@ func (daemon *Daemon) ContainerExecInspect(id string) (*backend.ExecInspect, err privileged = &e.Privileged } - return &backend.ExecInspect{ + return &containertypes.ExecInspectResponse{ ID: e.ID, Running: e.Running, ExitCode: e.ExitCode, - ProcessConfig: &backend.ExecProcessConfig{ + ProcessConfig: &containertypes.ExecProcessConfig{ Tty: e.Tty, Entrypoint: e.Entrypoint, Arguments: e.Args, diff --git a/daemon/server/backend/backend.go b/daemon/server/backend/backend.go index 384c757704..d13f7cfc7c 100644 --- a/daemon/server/backend/backend.go +++ b/daemon/server/backend/backend.go @@ -149,14 +149,6 @@ type ExecStartConfig struct { ConsoleSize *[2]uint `json:",omitempty"` } -// ExecInspect holds information about a running process started -// with docker exec. -type ExecInspect = container.ExecInspectResponse - -// ExecProcessConfig holds information about the exec process -// running on the host. -type ExecProcessConfig = container.ExecProcessConfig - // CreateImageConfig is the configuration for creating an image from a // container. type CreateImageConfig struct { diff --git a/daemon/server/router/container/backend.go b/daemon/server/router/container/backend.go index 8318094f64..56aa98a299 100644 --- a/daemon/server/router/container/backend.go +++ b/daemon/server/router/container/backend.go @@ -15,7 +15,7 @@ import ( // execBackend includes functions to implement to provide exec functionality. type execBackend interface { ContainerExecCreate(name string, options *container.ExecCreateRequest) (string, error) - ContainerExecInspect(id string) (*backend.ExecInspect, error) + ContainerExecInspect(id string) (*container.ExecInspectResponse, error) ContainerExecResize(ctx context.Context, name string, height, width uint32) error ContainerExecStart(ctx context.Context, name string, options backend.ExecStartConfig) error ExecExists(name string) (bool, error)