mirror of
https://github.com/docker/compose.git
synced 2026-02-09 01:59:22 +08:00
fix(run): Ensure images exist only for the target service in run command
Signed-off-by: Suleiman Dibirov <idsulik@gmail.com>
This commit is contained in:
committed by
Guillaume Lours
parent
a8933c91e7
commit
557e0b6ec7
@@ -97,7 +97,15 @@ func (s *composeService) prepareRun(ctx context.Context, project *types.Project,
|
||||
Add(api.SlugLabel, slug).
|
||||
Add(api.OneoffLabel, "True")
|
||||
|
||||
if err := s.ensureImagesExists(ctx, project, opts.Build, opts.QuietPull); err != nil { // all dependencies already checked, but might miss service img
|
||||
// Only ensure image exists for the target service, dependencies were already handled by startDependencies
|
||||
var buildOpts *api.BuildOptions
|
||||
if opts.Build != nil {
|
||||
// Create a copy of build options and restrict to only the target service
|
||||
buildOptsCopy := *opts.Build
|
||||
buildOptsCopy.Services = []string{opts.Service}
|
||||
buildOpts = &buildOptsCopy
|
||||
}
|
||||
if err := s.ensureImagesExists(ctx, project, buildOpts, opts.QuietPull); err != nil { // all dependencies already checked, but might miss service img
|
||||
return "", err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user