Skip to content

Commit 7fea9f7

Browse files
gloursndeloof
authored andcommitted
use project instead of DownOptions.project to list service images in pkg.compose.down
Signed-off-by: Guillaume Lours <[email protected]>
1 parent d871cb9 commit 7fea9f7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/compose/down.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *composeService) down(ctx context.Context, projectName string, options a
8282
ops := s.ensureNetworksDown(ctx, project, w)
8383

8484
if options.Images != "" {
85-
ops = append(ops, s.ensureImagesDown(ctx, projectName, options, w)...)
85+
ops = append(ops, s.ensureImagesDown(ctx, project, options, w)...)
8686
}
8787

8888
if options.Volumes {
@@ -114,9 +114,9 @@ func (s *composeService) ensureVolumesDown(ctx context.Context, project *types.P
114114
return ops
115115
}
116116

117-
func (s *composeService) ensureImagesDown(ctx context.Context, projectName string, options api.DownOptions, w progress.Writer) []downOp {
117+
func (s *composeService) ensureImagesDown(ctx context.Context, project *types.Project, options api.DownOptions, w progress.Writer) []downOp {
118118
var ops []downOp
119-
for image := range s.getServiceImages(options, projectName) {
119+
for image := range s.getServiceImages(options, project) {
120120
image := image
121121
ops = append(ops, func() error {
122122
return s.removeImage(ctx, image, w)
@@ -144,15 +144,15 @@ func (s *composeService) ensureNetworksDown(ctx context.Context, project *types.
144144
return ops
145145
}
146146

147-
func (s *composeService) getServiceImages(options api.DownOptions, projectName string) map[string]struct{} {
147+
func (s *composeService) getServiceImages(options api.DownOptions, project *types.Project) map[string]struct{} {
148148
images := map[string]struct{}{}
149-
for _, service := range options.Project.Services {
149+
for _, service := range project.Services {
150150
image := service.Image
151151
if options.Images == "local" && image != "" {
152152
continue
153153
}
154154
if image == "" {
155-
image = getImageName(service, projectName)
155+
image = getImageName(service, project.Name)
156156
}
157157
images[image] = struct{}{}
158158
}

0 commit comments

Comments
 (0)