diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-26 13:04:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-26 13:04:37 -0400 |
commit | f99954c7ca4428e501676fa47a63b5cecadd9454 (patch) | |
tree | 2e62d26620f7feca4b98d63b56c88fd27d322124 /pkg/api/handlers/compat/containers.go | |
parent | 3a9d5248ac65358e7a4f123c2cdbe93584084d6a (diff) | |
parent | fa6ba6802618e3e23746c4b4707fb403a55514ae (diff) | |
download | podman-f99954c7ca4428e501676fa47a63b5cecadd9454.tar.gz podman-f99954c7ca4428e501676fa47a63b5cecadd9454.tar.bz2 podman-f99954c7ca4428e501676fa47a63b5cecadd9454.zip |
Merge pull request #7409 from zhangguanzhang/apiv2-create-ctr-with-invalid-entrypoint
fix apiv2 will create containers with incorrect commands
Diffstat (limited to 'pkg/api/handlers/compat/containers.go')
-rw-r--r-- | pkg/api/handlers/compat/containers.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 6943b15ff..1ae6a990b 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -319,6 +319,14 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, SizeRootFs: &inspect.SizeRootFs, } + // set Path and Args + processArgs := l.Config().Spec.Process.Args + if len(processArgs) > 0 { + cb.Path = processArgs[0] + } + if len(processArgs) > 1 { + cb.Args = processArgs[1:] + } stopTimeout := int(l.StopTimeout()) exposedPorts := make(nat.PortSet) @@ -346,7 +354,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, OpenStdin: inspect.Config.OpenStdin, StdinOnce: inspect.Config.StdinOnce, Env: inspect.Config.Env, - Cmd: inspect.Config.Cmd, + Cmd: l.Command(), Healthcheck: nil, ArgsEscaped: false, Image: imageName, |