Merge pull request #8440 from psakar/fix-8433

APIv2 - wrong command and args for created container
This commit is contained in:
OpenShift Merge Robot
2020-11-23 19:15:20 +01:00
committed by GitHub

View File

@ -137,7 +137,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
aliases []string aliases []string
capAdd []string capAdd []string
cappDrop []string cappDrop []string
entrypoint string entrypoint *string
init bool init bool
specPorts []specgen.PortMapping specPorts []specgen.PortMapping
) )
@ -181,13 +181,14 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
// marshall it to json; otherwise it should just be the string // marshall it to json; otherwise it should just be the string
// value // value
if len(cc.Config.Entrypoint) > 0 { if len(cc.Config.Entrypoint) > 0 {
entrypoint = cc.Config.Entrypoint[0] entrypoint = &cc.Config.Entrypoint[0]
if len(cc.Config.Entrypoint) > 1 { if len(cc.Config.Entrypoint) > 1 {
b, err := json.Marshal(cc.Config.Entrypoint) b, err := json.Marshal(cc.Config.Entrypoint)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
} }
entrypoint = string(b) var jsonString = string(b)
entrypoint = &jsonString
} }
} }
@ -322,7 +323,7 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup
DeviceReadIOPs: readIops, DeviceReadIOPs: readIops,
DeviceWriteBPs: writeBps, DeviceWriteBPs: writeBps,
DeviceWriteIOPs: writeIops, DeviceWriteIOPs: writeIops,
Entrypoint: &entrypoint, Entrypoint: entrypoint,
Env: cc.Config.Env, Env: cc.Config.Env,
Expose: expose, Expose: expose,
GroupAdd: cc.HostConfig.GroupAdd, GroupAdd: cc.HostConfig.GroupAdd,