pkg/compose: remove redundant uses of strslice.StrSlice

The strslice.StrSlice type is a string-slice with a custom JSON Unmarshal
function to provide backward-compatibility with older API requests (see
[moby@17d6f00] and [moby@ea4a067]).

Given that the type is assigned implicitly through the fields on HostConfig,
we can just use a regular []string instead.

[moby@17d6f00]: 17d6f00ec2
[moby@ea4a067]: ea4a06740b

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2025-07-01 10:35:39 +02:00 committed by Nicolas De loof
parent 317ebcd3b0
commit 2c69fc3d4d

View File

@ -36,7 +36,6 @@ import (
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/mount" "github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/network" "github.com/docker/docker/api/types/network"
"github.com/docker/docker/api/types/strslice"
"github.com/docker/docker/api/types/versions" "github.com/docker/docker/api/types/versions"
volumetypes "github.com/docker/docker/api/types/volume" volumetypes "github.com/docker/docker/api/types/volume"
"github.com/docker/go-connections/nat" "github.com/docker/go-connections/nat"
@ -181,15 +180,12 @@ func (s *composeService) getCreateConfigs(ctx context.Context,
return createConfigs{}, err return createConfigs{}, err
} }
var ( var runCmd, entrypoint []string
runCmd strslice.StrSlice
entrypoint strslice.StrSlice
)
if service.Command != nil { if service.Command != nil {
runCmd = strslice.StrSlice(service.Command) runCmd = service.Command
} }
if service.Entrypoint != nil { if service.Entrypoint != nil {
entrypoint = strslice.StrSlice(service.Entrypoint) entrypoint = service.Entrypoint
} }
var ( var (
@ -286,8 +282,8 @@ func (s *composeService) getCreateConfigs(ctx context.Context,
Annotations: service.Annotations, Annotations: service.Annotations,
Binds: binds, Binds: binds,
Mounts: mounts, Mounts: mounts,
CapAdd: strslice.StrSlice(service.CapAdd), CapAdd: service.CapAdd,
CapDrop: strslice.StrSlice(service.CapDrop), CapDrop: service.CapDrop,
NetworkMode: networkMode, NetworkMode: networkMode,
Init: service.Init, Init: service.Init,
IpcMode: container.IpcMode(service.Ipc), IpcMode: container.IpcMode(service.Ipc),