don't apply restart_policy on `compose run`

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2021-06-21 08:24:29 +02:00
parent 796d08d778
commit 852aae0a39
2 changed files with 5 additions and 0 deletions

View File

@ -470,6 +470,7 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec
Filters: filters.NewArgs( Filters: filters.NewArgs(
projectFilter(project.Name), projectFilter(project.Name),
serviceFilter(service.Name), serviceFilter(service.Name),
oneOffFilter(false),
), ),
All: true, All: true,
}) })

View File

@ -50,6 +50,10 @@ func (s *composeService) RunOneOffContainer(ctx context.Context, project *types.
} }
service.Scale = 1 service.Scale = 1
service.StdinOpen = true 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.SlugLabel, slug)
service.Labels = service.Labels.Add(api.OneoffLabel, "True") service.Labels = service.Labels.Add(api.OneoffLabel, "True")