diff options
author | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-22 18:15:53 +0800 |
---|---|---|
committer | zhangguanzhang <zhangguanzhang@qq.com> | 2020-08-24 23:07:30 +0800 |
commit | fa6ba6802618e3e23746c4b4707fb403a55514ae (patch) | |
tree | 807e78f11803170afec2b27963398218ce1df4d0 /pkg/api/handlers/compat/containers.go | |
parent | 4828455055010a1376f1e83832bfa34787f3a1e7 (diff) | |
download | podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.tar.gz podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.tar.bz2 podman-fa6ba6802618e3e23746c4b4707fb403a55514ae.zip |
fix apiv2 will create containers with incorrect commands
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
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, |