Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 6bfdfa8

Browse files
authored
Merge pull request #1821 from ndeloof/autoremove_restart_policy
Don't apply restart_policy on `compose run`
2 parents 796d08d + 852aae0 commit 6bfdfa8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

pkg/compose/convergence.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ func (s *composeService) startService(ctx context.Context, project *types.Projec
470470
Filters: filters.NewArgs(
471471
projectFilter(project.Name),
472472
serviceFilter(service.Name),
473+
oneOffFilter(false),
473474
),
474475
All: true,
475476
})

pkg/compose/run.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ func (s *composeService) RunOneOffContainer(ctx context.Context, project *types.
5050
}
5151
service.Scale = 1
5252
service.StdinOpen = true
53+
service.Restart = ""
54+
if service.Deploy != nil {
55+
service.Deploy.RestartPolicy = nil
56+
}
5357
service.Labels = service.Labels.Add(api.SlugLabel, slug)
5458
service.Labels = service.Labels.Add(api.OneoffLabel, "True")
5559

0 commit comments

Comments
 (0)