From c11cff4542a3e8b1b14086601b219310ed0f7f1b Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Tue, 28 Apr 2020 12:20:10 +0200 Subject: cmd, podman: do not override entrypoint if unset Signed-off-by: Giuseppe Scrivano --- pkg/specgen/generate/container_create.go | 9 +++++---- pkg/specgen/generate/oci.go | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'pkg/specgen') diff --git a/pkg/specgen/generate/container_create.go b/pkg/specgen/generate/container_create.go index f04e1548f..14836035d 100644 --- a/pkg/specgen/generate/container_create.go +++ b/pkg/specgen/generate/container_create.go @@ -130,7 +130,7 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l options = append(options, libpod.WithName(s.Name)) } if pod != nil { - logrus.Debugf("adding container to pod %s", pod.Name) + logrus.Debugf("adding container to pod %s", pod.Name()) options = append(options, rt.WithPod(pod)) } destinations := []string{} @@ -155,11 +155,12 @@ func createContainerOptions(rt *libpod.Runtime, s *specgen.SpecGenerator, pod *l options = append(options, libpod.WithNamedVolumes(vols)) } - if len(s.Command) != 0 { + if s.Command != nil { options = append(options, libpod.WithCommand(s.Command)) } - - options = append(options, libpod.WithEntrypoint(s.Entrypoint)) + if s.Entrypoint != nil { + options = append(options, libpod.WithEntrypoint(s.Entrypoint)) + } if s.StopSignal != nil { options = append(options, libpod.WithStopSignal(*s.StopSignal)) } diff --git a/pkg/specgen/generate/oci.go b/pkg/specgen/generate/oci.go index 87262684e..f0b4d1111 100644 --- a/pkg/specgen/generate/oci.go +++ b/pkg/specgen/generate/oci.go @@ -67,7 +67,7 @@ func makeCommand(ctx context.Context, s *specgen.SpecGenerator, img *image.Image finalCommand = append(finalCommand, entrypoint...) command := s.Command - if len(command) == 0 && img != nil { + if command == nil && img != nil { newCmd, err := img.Cmd(ctx) if err != nil { return nil, err -- cgit v1.2.3-54-g00ecf