From 852aae0a398c828f1a5d4fb347985d0e96311ca0 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 21 Jun 2021 08:24:29 +0200 Subject: [PATCH] don't apply restart_policy on `compose run` Signed-off-by: Nicolas De Loof --- pkg/compose/convergence.go | 1 + pkg/compose/run.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/pkg/compose/convergence.go b/pkg/compose/convergence.go index 5565ab0ef..03d7e4b35 100644 --- a/pkg/compose/convergence.go +++ b/pkg/compose/convergence.go @@ -470,6 +470,7 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec Filters: filters.NewArgs( projectFilter(project.Name), serviceFilter(service.Name), + oneOffFilter(false), ), All: true, }) diff --git a/pkg/compose/run.go b/pkg/compose/run.go index 7ecde9e58..947e38b57 100644 --- a/pkg/compose/run.go +++ b/pkg/compose/run.go @@ -50,6 +50,10 @@ func (s *composeService) RunOneOffContainer(ctx context.Context, project *types. } service.Scale = 1 service.StdinOpen = true + service.Restart = "" + if service.Deploy != nil { + service.Deploy.RestartPolicy = nil + } service.Labels = service.Labels.Add(api.SlugLabel, slug) service.Labels = service.Labels.Add(api.OneoffLabel, "True")