MCPcopy
hub / github.com/docker/compose / removeVolume

Method removeVolume

pkg/compose/down.go:261–276  ·  view source on GitHub ↗
(ctx context.Context, id string)

Source from the content-addressed store, hash-verified

259}
260
261func (s *composeService) removeVolume(ctx context.Context, id string) error {
262 resource := fmt.Sprintf("Volume %s", id)
263
264 _, err := s.apiClient().VolumeInspect(ctx, id, client.VolumeInspectOptions{})
265 if errdefs.IsNotFound(err) {
266 // Already gone
267 return nil
268 }
269
270 return s.removeResource(resource, func() error {
271 _, err := s.apiClient().VolumeRemove(ctx, id, client.VolumeRemoveOptions{
272 Force: true,
273 })
274 return err
275 })
276}
277
278// removeResource emits a "Removing" progress event, calls op, then emits the appropriate
279// completion event based on the error: nil→Removed, conflict→still-in-use warning, not-found→gone warning.

Callers 1

ensureVolumesDownMethod · 0.95

Calls 4

apiClientMethod · 0.95
removeResourceMethod · 0.95
VolumeInspectMethod · 0.45
VolumeRemoveMethod · 0.45

Tested by

no test coverage detected